This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Fix linker garbage collection tests for targets that use an underscore prefix
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Wed, 29 Oct 2008 08:30:34 +0000
- Subject: PATCH: Fix linker garbage collection tests for targets that use an underscore prefix
Hi Guys,
I am applying the patch below to solve a problem with the linker's
garbage collection tests (ld/testsuite/ld-gc) on targets where the
compiler will prefix global symbols with an underscore. This fixes
testsuite failures for the bfin, cris, hppa, powerpc, h8300, mn10300
and v850 targets.
Cheers
Nick
ld/testsuite/ChangeLog
2008-10-29 Nick Clifton <nickc@redhat.com>
* ld-gc/gc.c (dummy_func): New function - present so that
underscore prefixed aliases can be created of the used_func and
main functions.
Index: ld/testsuite/ld-gc/gc.c
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-gc/gc.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 gc.c
*** ld/testsuite/ld-gc/gc.c 23 Jan 2008 16:05:45 -0000 1.2
--- ld/testsuite/ld-gc/gc.c 29 Oct 2008 07:55:09 -0000
*************** main (void)
*** 19,21 ****
--- 19,41 ----
{
return used_func (5);
}
+
+ void
+ dummy_func (void)
+ {
+ /* These are here in case the target prepends an underscore to
+ the start of function names. They are inside a dummy function
+ so that they will appear at the end of gcc's assembler output,
+ after the definitions of main() and used_func(), rather than
+ at the beginning of the file. */
+
+ __asm__(".ifndef main\n\
+ .global main\n\
+ .set main, _main\n\
+ .endif");
+
+ __asm__(".ifndef used_func\n\
+ .global used_func\n\
+ .set used_func, _used_func\n\
+ .endif");
+ }