comparison extra/ld @ 72:84eb35251849

Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
author lost@l-w.ca
date Tue, 12 Apr 2011 14:16:36 -0600
parents
children 17d82b46f4c9
comparison
equal deleted inserted replaced
71:6dafb4f0fa56 72:84eb35251849
1 #!/bin/sh
2 #
3 #
4 # Copyright 2009 by William Astle <lost@l-w.ca>
5 #
6 #This file is part of LWTOOLS.
7 #
8 #LWTOOLS is free software: you can redistribute it and/or modify it under the
9 #terms of the GNU General Public License as published by the Free Software
10 #Foundation, either version 3 of the License, or (at your option) any later
11 #version.
12 #
13 #This program is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 #more details.
17 #
18 #You should have received a copy of the GNU General Public License along with
19 #this program. If not, see <http://www.gnu.org/licenses/>.
20
21 # this was based somewhat on the "as" script from gcc6809
22
23 echo "LWTOOLS-as $0 $*"
24 path_to_lwlink=lwlink
25
26 # Set defaults. Some are based on the target type, which is
27 # determined by the name by which the program was invoked.
28 output_file=a.out
29 libpaths=
30 libs=
31 verbose=
32 case $0 in
33 *m6809-coco-*)
34 options="--format=decb"
35 # options="-b .text=0x2000 -b .data=0x7000 -b .bss=0x7C00 -b .ctors=0x7F00 -b .dtors=0x7F80 -b vector=0x7FF0"
36 # aslink_options="-nwxst"
37 # exe_suffix=.bin
38 ;;
39 *)
40 options="--format=decb"
41 # options="-b .text=0x8000 -b .data=0x1000 -b .bss=0x0100 -b .ctors=0xFD00 -b .dtors=0xFE00 -b vector=0xFFF0"
42 # aslink_options="-nwxso"
43 # exe_suffix=.s19
44 ;;
45 esac
46
47
48 while [ "$1" != "" ]; do
49 arg=$1; shift
50 case $arg in
51 -gn)
52 # Generate NoICE debug file
53 # ignored because debugging not supported by targets
54 ;;
55 -gs)
56 # Generate SDCC debug file
57 # ignored because debugging not supported by targets
58 ;;
59 -o)
60 output_file=$1; shift
61 ;;
62 -L*)
63 arg=${arg#-L}
64 libpaths="$libpaths --library-path=$arg"
65 ;;
66 -l*)
67 arg=${arg#-l}
68 libs="$libs --library=$arg"
69 ;;
70 --section-start)
71 section_value=$1; shift
72 options="$options --section-start=$section_value"
73 ;;
74 -Tbss)
75 options="$options --section-start=.bss=$1"; shift
76 ;;
77 -Tdata)
78 options="$options --section-start=.data=$1"; shift
79 ;;
80 -Ttext|-Tcode)
81 options="$options --section-start=.text=$1"; shift
82 ;;
83 -v|--verbose)
84 verbose=1
85 ;;
86 *crt0.o)
87 startup_files=$arg
88 ;;
89 -g)
90 # Ignored by GNU ld; we should do the same
91 true
92 ;;
93 -h|--help)
94 echo "ld (m6809)"
95 exit 0
96 ;;
97 -T)
98 echo "-T scripts not supported";
99 exit 1;
100 ;;
101 --format-lwex)
102 options="$options --format=lwex"
103 ;;
104
105 -*)
106 echo "ld (m6809): unknown option $arg"
107 exit 1
108 ;;
109 *)
110 input_files="$input_files $arg"
111 ;;
112 esac
113 done
114
115 options="$options -o $output_file"
116
117 if [ "$verbose" = "1" ]; then
118 echo "$path_to_lwlink $options $input_files $startup_files $libpaths $libs"
119 fi
120
121 $path_to_lwlink $options $input_files $startup_files $libpaths $libs
122 rc=$?
123
124 if [ "$rc" != "0" ]; then
125 rm -f $output_file
126 exit $rc
127 fi