scummvm random work
[patches.git] / elf2flt-user-label-prefix.patch
1 Index: configure.in
2 ===================================================================
3 RCS file: /var/cvs/elf2flt/configure.in,v
4 retrieving revision 1.10
5 diff -u -p -r1.10 configure.in
6 --- configure.in 3 Jan 2007 03:49:47 -0000 1.10
7 +++ configure.in 22 Sep 2007 10:04:57 -0000
8 @@ -106,6 +106,14 @@ Run configure again specifying these opt
9 ])
10 fi
11
12 +SYMBOL_PREFIX=
13 +case $target in
14 + bfin*)
15 + SYMBOL_PREFIX=_
16 + ;;
17 +esac
18 +
19 +
20 dnl Checks for header files.
21 AC_HEADER_STDC
22 AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
23 @@ -129,6 +137,7 @@ AC_SUBST(binutils_include_dir)
24 AC_SUBST(binutils_ldscript_dir)
25 AC_SUBST(got_check)
26 AC_SUBST(emit_relocs)
27 +AC_SUBST(SYMBOL_PREFIX)
28
29 -AC_OUTPUT(Makefile ld-elf2flt)
30 +AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)
31
32 Index: elf2flt.ld
33 ===================================================================
34 RCS file: /var/cvs/elf2flt/elf2flt.ld,v
35 retrieving revision 1.15
36 diff -u -p -r1.15 elf2flt.ld
37 --- elf2flt.ld 21 Jul 2006 13:11:04 -0000 1.15
38 +++ elf2flt.ld 22 Sep 2007 10:04:58 -0000
39 @@ -1,5 +1,5 @@
40
41 -ENTRY (_start)
42 +ENTRY (@SYMBOL_PREFIX@_start)
43
44 MEMORY {
45 flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
46 @@ -10,7 +10,7 @@ SECTIONS {
47 .text 0x0 : {
48 . = . + 4;
49 . = ALIGN(0x4) ;
50 - _stext = . ;
51 + @SYMBOL_PREFIX@_stext = . ;
52 *(.text)
53 *(.text.*)
54 *(.gnu.warning)
55 @@ -32,19 +32,19 @@ W_RODAT *(.gnu.linkonce.r*)
56 the start followed by the code pointed to by entries
57 in the lookup table. */
58 . = ALIGN (4) ;
59 - PROVIDE(__ctbp = .);
60 + PROVIDE(@SYMBOL_PREFIX@__ctbp = .);
61 *(.call_table_data)
62 *(.call_table_text)
63
64 . = ALIGN(0x20) ;
65 - _etext = . ;
66 + @SYMBOL_PREFIX@_etext = . ;
67 } > flatmem
68
69 .data : {
70 . = ALIGN(0x4) ;
71 - _sdata = . ;
72 - __data_start = . ;
73 - data_start = . ;
74 + @SYMBOL_PREFIX@_sdata = . ;
75 + @SYMBOL_PREFIX@__data_start = . ;
76 + @SYMBOL_PREFIX@data_start = . ;
77 *(.got.plt)
78 *(.got)
79 FILL(0) ;
80 @@ -65,14 +65,14 @@ R_RODAT *(.gnu.linkonce.r*)
81
82 /* Microblaze has .sdata and .sbss (small bss). They must
83 be contiguous, so please don't move any of this. JW */
84 - _ssrw = . ;
85 + @SYMBOL_PREFIX@_ssrw = . ;
86 *(.sdata)
87 *(.sdata.*)
88 *(.sbss) /* Don't move this! */
89 - _essrw = . ;
90 + @SYMBOL_PREFIX@_essrw = . ;
91
92 - _ssrw_size = _essrw - _ssrw;
93 - PROVIDE(_SDA_BASE_ = _ssrw + (_ssrw_size / 2));
94 + @SYMBOL_PREFIX@_ssrw_size = @SYMBOL_PREFIX@_essrw - @SYMBOL_PREFIX@_ssrw;
95 + PROVIDE(@SYMBOL_PREFIX@_SDA_BASE_ = @SYMBOL_PREFIX@_ssrw + (@SYMBOL_PREFIX@_ssrw_size / 2));
96
97 *(.gnu.linkonce.s.*)
98 *(__libc_atexit)
99 @@ -82,15 +82,15 @@ R_RODAT *(.gnu.linkonce.r*)
100
101 /* microblaze-specific read-only small data area
102 and associated locating symbols */
103 - _ssro = . ;
104 + @SYMBOL_PREFIX@_ssro = . ;
105 *(.sdata2)
106 - _essro = . ;
107 - _ssro_size = _essro - _ssro;
108 - PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2));
109 + @SYMBOL_PREFIX@_essro = . ;
110 + @SYMBOL_PREFIX@_ssro_size = @SYMBOL_PREFIX@_essro - @SYMBOL_PREFIX@_ssro;
111 + PROVIDE(@SYMBOL_PREFIX@_SDA2_BASE_ = @SYMBOL_PREFIX@_ssro + (@SYMBOL_PREFIX@_ssro_size / 2));
112
113 . = ALIGN(4) ;
114 - __CTOR_LIST__ = .;
115 - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
116 + @SYMBOL_PREFIX@__CTOR_LIST__ = .;
117 + LONG((@SYMBOL_PREFIX@__CTOR_END__ - @SYMBOL_PREFIX@__CTOR_LIST__) / 4 - 2)
118 SINGLE_LINK: /* gcc uses crtbegin.o to find the start of
119 SINGLE_LINK: the constructors, so we make sure it is
120 SINGLE_LINK: first. Because this is a wildcard, it
121 @@ -109,38 +109,38 @@ SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crte
122 SINGLE_LINK: KEEP (*(SORT(.ctors.*)))
123 KEEP (*(.ctors))
124 LONG(0)
125 - __CTOR_END__ = .;
126 - __DTOR_LIST__ = .;
127 - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
128 + @SYMBOL_PREFIX@__CTOR_END__ = .;
129 + @SYMBOL_PREFIX@__DTOR_LIST__ = .;
130 + LONG((@SYMBOL_PREFIX@__DTOR_END__ - @SYMBOL_PREFIX@__DTOR_LIST__) / 4 - 2)
131 SINGLE_LINK: KEEP (*crtbegin*.o(.dtors))
132 SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
133 SINGLE_LINK: KEEP (*(SORT(.dtors.*)))
134 KEEP (*(.dtors))
135 LONG(0)
136 - __DTOR_END__ = .;
137 + @SYMBOL_PREFIX@__DTOR_END__ = .;
138
139 - PROVIDE (__preinit_array_start = .);
140 + PROVIDE (@SYMBOL_PREFIX@__preinit_array_start = .);
141 KEEP (*(.preinit_array))
142 - PROVIDE (__preinit_array_end = .);
143 + PROVIDE (@SYMBOL_PREFIX@__preinit_array_end = .);
144
145 - PROVIDE (__init_array_start = .);
146 + PROVIDE (@SYMBOL_PREFIX@__init_array_start = .);
147 KEEP (*(SORT(.init_array.*)))
148 KEEP (*(.init_array))
149 - PROVIDE (__init_array_end = .);
150 + PROVIDE (@SYMBOL_PREFIX@__init_array_end = .);
151
152 - PROVIDE (__fini_array_start = .);
153 + PROVIDE (@SYMBOL_PREFIX@__fini_array_start = .);
154 KEEP (*(.fini_array))
155 KEEP (*(SORT(.fini_array.*)))
156 - PROVIDE (__fini_array_end = .);
157 + PROVIDE (@SYMBOL_PREFIX@__fini_array_end = .);
158
159 . = ALIGN(0x10) ;
160 - _edata = . ;
161 + @SYMBOL_PREFIX@_edata = . ;
162 } > flatmem
163
164 .bss : {
165 . = ALIGN(0x4) ;
166 - _sbss = ALIGN(0x4) ;
167 - __bss_start = . ;
168 + @SYMBOL_PREFIX@_sbss = ALIGN(0x4) ;
169 + @SYMBOL_PREFIX@__bss_start = . ;
170 *(.dynsbss)
171 *(.sbss)
172 *(.sbss.*)
173 @@ -152,9 +152,9 @@ SINGLE_LINK: KEEP (*(SORT(.dtors.*)))
174 *(.gnu.linkonce.b*)
175 *(COMMON)
176 . = ALIGN(0x10) ;
177 - _ebss = . ;
178 - _end = . ;
179 - end = . ;
180 + @SYMBOL_PREFIX@_ebss = . ;
181 + @SYMBOL_PREFIX@_end = . ;
182 + @SYMBOL_PREFIX@end = . ;
183 } > flatmem
184
185 .stack : {