This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Should the linker tests notice multilib variations ?
- To: binutils@sourceware.cygnus.com
- Subject: Should the linker tests notice multilib variations ?
- From: Nick Clifton <nickc@cygnus.com>
- Date: Tue, 13 Jul 1999 11:24:21 +0100
Hi Guys,
I noticed today that the linker testsuite ignores any mutlilib
switches set up by the schedule of variants when it is run. This
seems a little strange to me, especially now that the testsuite is
testing compiler initiated features such as selective linking.
I have appended a patch below which attempts to add support for the
multilib switches, but I am not very happy with it. In particular I
have had to add some grubby code to detect if the code was compiled
with a big endian or little endian switch and so pass on a -EB or
-EL switch to the linker or assembler.
I had to do this because for the ARM toolchain at least, the
compiler does not accept -EB only -mbig-endian, whereas the linker
only accepts -EB not -mbig-endian. Normally gcc would invoke the
linker, and so it would translate a -mbig-endian command line switch
into a -EB switch. But in the case of the linker testsuite, the
compiler and linker are each invoked seperately, and the switches
passed to the linker do not get the opportunity to be translated by
gcc.
This patch still breaks several of the ld tests for the ARM however,
because the testsuite uses custom linker scripts which do not
include a mutliple option OUTPUT_FORMAT directive, so the default
output format (little endian arm) is used, and this generates an
error when used to link big endian arm object files. I am not sure
how to solve this problem. Perhaps the linker ought to be more
clever about selecting an output format if it is told on the command
line the endianness that the user desires.
Cheers
Nick
1999-07-13 Nick Clifton <nickc@cygnus.com>
* lib/ld-lib.exp (proc big_or_little_endian): New proc.
Determine if a big endian or little endian output format hass
been selected by any of the multilib options, and if so return
a suitable command line option for the linker/assembler.
(proc default_ld_link): Include the result of proc
big_or_little_endian on the command line to the linker.
(proc ld_simple_link): Include the result of proc
big_or_little_endian on the command line to the linker.
(proc default_ld_compile): Append multilib flags to compiler
switches.
(proc default_ld_assemble): Include the result of proc
big_or_little_endian on the command line to the linker.
Index: ld-lib.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.5
diff -p -r1.5 ld-lib.exp
*** ld-lib.exp 1999/06/20 17:46:35 1.5
--- ld-lib.exp 1999/07/13 10:18:36
*************** proc default_ld_relocate { ld target obj
*** 43,48 ****
--- 43,79 ----
}
}
+ # Look for big-endian or little-endian switches in the multlib
+ # options and translate these into a -EB or -EL switch. Note
+ # we cannot rely upon proc process_multilib_options to do this
+ # for us because for some targets the compiler does not support
+ # -EB/-EL but it does support -mbig-endian/-mlittle-endian, and
+ # the site.exp file will include the switch "-mbig-endian"
+ # (rather than "big-endian") which is not detected by proc
+ # process_multilib_options.
+
+ proc big_or_little_endian {} {
+
+ if [board_info [target_info name] exists multilib_flags] {
+ set tmp_flags " [board_info [target_info name] multilib_flags]";
+
+ foreach x $tmp_flags {
+ case $x in {
+ {*big*endian eb EB} {
+ set flags " -EB"
+ return $flags
+ }
+ {*little*endian el EL} {
+ set flags " -EL"
+ return $flags
+ }
+ }
+ }
+ }
+
+ set flags ""
+ return $flags
+ }
#
# default_ld_link
*************** proc default_ld_link { ld target objects
*** 61,70 ****
perror "$ld does not exist"
return 0
}
! verbose -log "$ld $HOSTING_EMU -o $target $objs $libs"
! catch "exec $ld $HOSTING_EMU -o $target $objs $libs" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
--- 92,103 ----
perror "$ld does not exist"
return 0
}
+
+ set flags [big_or_little_endian]
! verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
! catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
*************** proc default_ld_simple_link { ld target
*** 85,94 ****
perror "$ld does not exist"
return 0
}
! verbose -log "$ld -o $target $objects"
! catch "exec $ld -o $target $objects" exec_output
set exec_output [prune_warnings $exec_output]
# We don't care if we get a warning about a non-existent start
--- 118,129 ----
perror "$ld does not exist"
return 0
}
+
+ set flags [big_or_little_endian]
! verbose -log "$ld $flags -o $target $objects"
! catch "exec $ld $flags -o $target $objects" exec_output
set exec_output [prune_warnings $exec_output]
# We don't care if we get a warning about a non-existent start
*************** proc default_ld_compile { cc source obje
*** 134,139 ****
--- 169,178 ----
set flags "$gcc_gas_flag $flags"
}
+ if [board_info [target_info name] exists multilib_flags] {
+ append flags " [board_info [target_info name] multilib_flags]";
+ }
+
verbose -log "$cc $flags -c $source -o $object"
catch "exec $cc $flags -c $source -o $object" exec_output
*************** proc default_ld_assemble { as source obj
*** 180,188 ****
if ![info exists ASFLAGS] { set ASFLAGS "" }
! verbose -log "$as $ASFLAGS -o $object $source"
! catch "exec $as $ASFLAGS -o $object $source" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
--- 219,229 ----
if ![info exists ASFLAGS] { set ASFLAGS "" }
! set flags [big_or_little_endian]
!
! verbose -log "$as $flags $ASFLAGS -o $object $source"
! catch "exec $as $flags $ASFLAGS -o $object $source" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1