[PATCH] LD/testsuite: Support late LD arguments in run_ld_link_tests

Maciej W. Rozycki macro@codesourcery.com
Mon Feb 18 18:28:00 GMT 2013


Hi,

 Having come up with another case where the first object named on the 
linker's command line must NOT be a shared library for the test to have 
any meaning I decided to bite the bullet and adjust run_ld_link_tests so 
that passing extra linker options/arguments is possible after the list of 
object files the procedure generates internally itself.  This complements 
the ld_after_inputfiles keyword we already support with run_dump_test.  

 The usual approach throughout our testsuite where there is such a need is 
to assemble each source required and then make an incremental link in a 
number of preparatory steps before the actual test is made.  I used this 
on a couple occasions as well, but eventually I came up with a set of 
tests for which this approach would be a maintenance nightmare, so I 
decided to solve this properly, and then painfully went through all the 
test scripts we have to adjust the call sites accordingly.  I have not 
adjusted any cases that may actually benefit from this change though, 
merely adjusted them mechanically to add the extra argument as an empty 
string.

 Some cases merely stick any shared libraries required in the usual LD 
options argument which makes them appear before relocatable objects.  
This may make sense where the objective of a test concerned is tangential 
to the order of objects on the command line or the shared libraries named 
actually have to come first for one reason or another.

 Please note however, that it is not the usual way LD is driven in 
real-life scenarios where it's the GCC driver that invokes LD, and that 
always places CRT relocatables first, before any shared libraries required 
(unless the CRT files are skipped altogether with the use of the 
-nostartfiles or -nostdlib options).  And obviously as we all must know 
very well the order of objects named on the command line does matter to LD 
very much.

 I'll be using this change with a patch I am going to post shortly; I 
intend to tweak the test cases I made earlier on as well.  I do not plan 
to change any other ones, but I encourage platform maintainers to review 
their targets for possible simplifications.

 I have tested this change across an extended version of Alan's usual set 
of targets with no regressions.  That must have covered the vast majority 
of changes this change introduces, but undoubtedly has missed an obscure 
target or two; I do hope I didn't make a typo there or missed a bit 
somewhere, but in either case any such mistake will be trivial to correct.  

 Here's the exact list of targets I covered in testing:

alpha-dec-vms
alpha-linux
alpha-linuxecoff
alpha-netbsd
alpha-unknown-freebsd4.7
arc-elf
arm-aout
arm-coff
arm-epoc-pe
arm-linuxeabi
arm-netbsdelf
arm-nto
arm-pe
arm-symbianelf
arm-vxworks
arm-wince-pe
avr-elf
bfin-elf
cr16-elf
cris-elf
crisv32-linux
crx-elf
d10v-elf
d30v-elf
dlx-elf
fr30-elf
frv-elf
frv-linux
h8300-elf
hppa-linux
hppa-hp-hpux10
hppa64-hp-hpux11.23
hppa64-linux
i370-linux
i386-linux
i386-lynxos
i386-netware
i386-linuxaout
i586-aout
i586-coff
i586-linux
i686-pc-beos
i686-pc-elf
i686-pe
i860-stardent-elf
i960-elf
ia64-elf
ia64-freebsd5
ia64-hpux
ia64-linux
ia64-netbsd
ia64-vms
ip2k-elf
iq2000-elf
lm32-elf
m32c-elf
m32r-elf
m68hc11-elf
m68hc12-elf
m68k-elf
m68k-linux
m68k-netbsd
mcore-elf
mcore-pe
mep-elf
microblaze-elf
mips-ecoff
mips-elf
mips-sde-elf
mips-sgi-irix5
mips-sgi-irix6
mips-freebsd
mips-linux
mips-vxworks
mips64-freebsd
mips64-linux
mips64el-freebsd
mips64el-linux
mipsel-ecoff
mipsel-elf
mipsel-freebsd
mipsel-linux
mipsel-vxworks
mipsisa32-elf
mipsisa32-linux
mipsisa32el-elf
mipsisa32el-linux
mipsisa64-elf
mipsisa64-linux
mipsisa64el-elf
mipsisa64el-linux
mmix
mn10200-elf
mn10300-elf
moxie-elf
ms1-elf
msp430-elf
ns32k-netbsd
or32-elf
pdp11-dec-aout
pj-elf
powerpc-eabisim
powerpc-linux
powerpc-nto
powerpc-wrs-vxworks
powerpc64-linux
ppc-lynxos
rs6000-aix4.3.3
rs6000-aix5.1
rx-elf
s390-linux
s390x-linux
sh-linux
sh-nto
sh-pe
sh-rtems
sh64-elf
shl-unknown-netbsdelf
sparc-aout
sparc-coff
sparc-linux
sparc64-linux
spu-elf
tic30-unknown-aout
tic30-unknown-coff
tic4x-coff
tic54x-coff
tic6x-elf
tilepro-elf
tx39-elf
v850-elf
vax-linux
vax-netbsdelf
x86_64-linux-gnu
x86_64-mingw32
xstormy16-elf
xtensa-elf
z8k-coff

I'll be happy to run testing for any additional obscure target requested 
though.

 Otherwise, OK to apply?

2013-02-18  Maciej W. Rozycki  <macro@codesourcery.com>

	ld/testsuite/
	* lib/ld-lib.exp (run_ld_link_tests): Add another argument, pass
	its contents to ar_simple_create and ld_simple_link after
	objfiles.
	* ld-aarch64/aarch64-elf.exp: Adjust accordingly.
	* ld-alpha/alpha.exp: Likewise.
	* ld-arm/arm-elf.exp: Likewise.
	* ld-arm/export-class.exp: Likewise.
	* ld-elf/comm-data.exp: Likewise.
	* ld-elf/eh-group.exp: Likewise.
	* ld-elf/elf.exp: Likewise.
	* ld-elf/export-class.exp: Likewise.
	* ld-elfvers/vers.exp: Likewise.
	* ld-frv/tls.exp: Likewise.
	* ld-i386/export-class.exp: Likewise.
	* ld-i386/i386.exp: Likewise.
	* ld-ia64/ia64.exp: Likewise.
	* ld-libs/libs.exp: Likewise.
	* ld-m68k/m68k.exp: Likewise.
	* ld-metag/metag.exp: Likewise.
	* ld-mips-elf/comm-data.exp: Likewise.
	* ld-mips-elf/export-class.exp: Likewise.
	* ld-mips-elf/mips-elf.exp: Likewise.
	* ld-mn10300/mn10300.exp: Likewise.
	* ld-pe/pe-compile.exp: Likewise.
	* ld-pe/pe.exp: Likewise.
	* ld-plugin/plugin.exp: Likewise.
	* ld-powerpc/aix52.exp: Likewise.
	* ld-powerpc/export-class.exp: Likewise.
	* ld-powerpc/powerpc.exp: Likewise.
	* ld-s390/s390.exp: Likewise.
	* ld-sh/sh-vxworks.exp: Likewise.
	* ld-sh/sh64/sh64.exp: Likewise.
	* ld-sparc/sparc.exp: Likewise.
	* ld-tic6x/tic6x.exp: Likewise.
	* ld-tilegx/tilegx.exp: Likewise.
	* ld-tilepro/tilepro.exp: Likewise.
	* ld-undefined/entry.exp: Likewise.
	* ld-vax-elf/vax-elf.exp: Likewise.
	* ld-x86-64/dwarfreloc.exp: Likewise.
	* ld-x86-64/export-class.exp: Likewise.
	* ld-x86-64/x86-64.exp: Likewise.
	* ld-xc16x/xc16x.exp: Likewise.
	* ld-xstormy16/xstormy16.exp: Likewise.
	* ld-xtensa/xtensa.exp: Likewise.

  Maciej

binutils-ld-test-after.diff
[Patch attached compressed due to its size.]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-ld-test-after.diff.bz2
Type: application/octet-stream
Size: 20653 bytes
Desc: 
URL: <https://sourceware.org/pipermail/binutils/attachments/20130218/43dbae12/attachment.obj>


More information about the Binutils mailing list