This patch is a major cleanup of the Solaris configurations of both bfd and ld.
The Solaris cases in both bfd/config.bfd and ld/configure.tgt have seen a
major cleanup, making the support for various Solaris versions explicit,
correcting several inconsistencies, and making it easier to remove support
for some versions in the future.
* All 32-bit-only configurations (Solaris < 7 on SPARC, Solaris < 10 on
x86) only include the 32-bit target vectors and linker emulations.
* For 32-bit-default targets on 64-bit systems (Solaris >= 7 on SPARC,
Solaris >= 10 on x86), the 32-bit target vectors and linker emulations
are the default while supporting the 64-bit ones.
* For 64-bit-default targets on 64-bit systems, it's the other way round.
They default to 64-bit target vectors etc. while also supporting the
32-bit ones.
* Added a warning to all Solaris cases in config.bfd not to include the
non-*_sol2 vectors to avoid the ambiguity reported in PR binutils/27666.
* On x86, the iamcu target vectors and linker emulations have been
removed: Solaris never supported the Intel MCU.
* On x86, the PE and PEI target vectors have been removed: they were only
supported in binutils proper. Their only use would be on EFI files
e.g. in GRUB, which doesn't justify their inclusion.
* With iamcu support gone, a few gas tests had to be disabled as on
VxWorks.
* The 32-bit Solaris/x86 ld configuration currently includes the
elf_i386_ldso emulation, which was never a emulation in its own right but
just an implementation detail of the elf_i386_sol2 emulation. Instead,
the settings that are not already provided by sourced .sh files are moved
into elf_i386_sol2.sh. Many settings became superfluous by just sourcing
elf_i386.sh as is already done in elf_x86_64_sol2.sh, massively
simplifying the emulation.
* Solaris-specific settings in generic emulparams scripts have been moved
to the *_sol2.sh files.
* NATIVE_LIB_DIRS in ld/configure.tgt now uses the default setting:
/usr/ccs/lib contains just a bunch of symlinks into /usr/lib at least
since Solaris 8.
* ld/emulparams/solaris2.sh now sets ELF_INTERPRETER_NAME to
/usr/lib/amd64/ld.so.1, matching both the native linker and
elf_i386_sol2.sh.
* The SEARCH_DIR statements in linker scripts on 64-bit targets contained
both the native (64-bit) and non-default (32-bit) directies. The latter
are completely pointless and are omitted using a new
LIBPATH_SKIP_NONNATIVE setting.
Tested on {amd64,i386}-pc-solaris2.11 and {sparcv9,sparc}-sun-solaris2.11,
and {x86_64,i686}-pc-linux-gnu as well as with gcc trunk bootstraps on the
Solaris targets. On those, I've compared the gas/ld and gas/gld 2.45.50
testresults with 2.45 ones.
2025-09-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
bfd:
* config.bfd <i[3-7]86-*-solaris2*>: Split into ...
<i[3-7]86-*-solaris2.1[01]*> ... this.
(targ_selvecs): Remove iamcu_elf32_vec, i386_coff_vec, i386_pei_vec.
(targ64_selvecs): Remove x86_64_pe_vec, x86_64_pei_vec.
<i[3-7]86-*-solaris2.[0-9]*>: ... and this.
[BFD64] <x86_64-*-solaris2*>: Change into x86_64-*-solaris2.1[01]*.
(targ_defvecs): Change to x86_64_elf64_sol2_vec.
(targ_selvecs): Remove iamcu_elf32_vec, i386_coff_vec,
i386_pei_vec, x86_64_pe_vec, x86_64_pei_vec.
<sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*>: Split into ...
<sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*>: ... this.
<sparc-*-solaris2.[0-6]*>: ... this.
[BFD64] <sparc-*-solaris2* | sparcv9-*-solaris2* |
sparc64-*-solaris2*>: Omit sparc-*-solaris2*.
(targ_defvec): Swap with targ_selvecs.
* testsuite/gas/i386/i386.exp: Disable iamcu tests on Solaris.
ld:
* configure.tgt <i[3-7]86-*-solaris2>: Split into ...
<i[3-7]86-*-solaris2.1[01]*>: .. this.
(targ_extra_emuls): Remove elf_i386_ldso and elf_iamcu.
<i[3-7]86-*-solaris2.[0-9]*>: ... and this.
<sparc64-*-solaris2*, sparcv9-*-solaris2*>: Change into ...
<sparc64-*-solaris2.[7-9]* | sparc64-*-solaris2.1[01]* |
sparcv9-*-solaris2.[7-9]* | sparcv9-*-solaris2.1[01]*>: ... this
(targ_extra_emuls): Reorder.
(tdir_elf32_sparc): Remove.
<sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*>: New case.
<sparc-*-solaris2.[0-6]*, sparc-*-solaris2.[0-6].*>: Change into ...
<sparc-*-solaris2.[0-6]*>: ... this.
<sparc-*-solaris2*>: Remove.
<x86_64-*-solaris2*>: Change into ...
<x86_64-*-solaris2.1[01]*>: ... this.
(targ_extra_emuls): Reorder. Remove elf_i386_ldso, elf_iamcu.
(tdir_elf_i386): Remove.
(NATIVE_LIB_DIRS): Remove Solaris handling.
* emulparams/elf32_sparc_sol2.sh (ELF_INTERPRETER_NAME): New
variable.
* emulparams/elf64_sparc.sh <sparc*-solaris*> (LIBPATH_SUFFIX):
Move ...
* emulparams/elf64_sparc_sol2.sh: ... here.
(LIBPATH_SKIP_NONNATIVE): New variable.
(ELF_INTERPRETER_NAME): Likewise.
* emulparams/elf_i386_ldso.sh: Merge into ...
* emulparams/elf_i386_sol2.sh: ... this.
Remove duplicate variables.
Source elf_i386.sh instead of elf_i386_ldso.sh.
* emulparams/elf_x86_64.sh <*-*-solaris2*> (ELF_INTERPRETER_NAME):
Move ...
* emulparams/elf_x86_64_sol2.sh: ... here.
Use /usr/lib/amd64/ld.so.1.
(LIBPATH_SKIP_NONNATIVE): New variable.
* emulparams/solaris2.sh: Fix comment.
* genscripts.sh: Fix typos.
Heed LIBPATH_SKIP_NONNATIVE.
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_coff_vec"
;;
- i[3-7]86-*-solaris2*)
+ i[3-7]86-*-solaris2.1[01]*)
+ # PR 27666: Do not include i386_elf32_vec or x86_64_elf64_vec.
targ_defvec=i386_elf32_sol2_vec
- targ_selvecs="iamcu_elf32_vec i386_coff_vec i386_pei_vec"
- targ64_selvecs="x86_64_elf64_sol2_vec x86_64_pe_vec x86_64_pei_vec"
+ targ64_selvecs=x86_64_elf64_sol2_vec
want64=true
;;
-#ifdef BFD64
- x86_64-*-solaris2*)
+ i[3-7]86-*-solaris2.[0-9]*)
+ # PR 27666: Do not include i386_elf32_vec here.
targ_defvec=i386_elf32_sol2_vec
- targ_selvecs="x86_64_elf64_sol2_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
+ ;;
+#ifdef BFD64
+ x86_64-*-solaris2.1[01]*)
+ # PR 27666: Do not include i386_elf32_vec or x86_64_elf64_vec.
+ targ_defvec=x86_64_elf64_sol2_vec
+ targ_selvecs=i386_elf32_sol2_vec
want64=true
;;
#endif
targ_selvecs="sh_coff_vec sh_coff_le_vec sh_coff_small_vec sh_coff_small_le_vec"
targ_underscore=yes
;;
-
- sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
+ sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*)
+ # PR 27666: Do not include sparc_elf32_vec or sparc_elf64_vec here.
+ targ_defvec=sparc_elf32_sol2_vec
+ targ64_selvecs=sparc_elf64_sol2_vec
+ want64=true
+ ;;
+ sparc-*-solaris2.[0-6]*)
# PR 27666: Do not include sparc_elf32_vec here.
targ_defvec=sparc_elf32_sol2_vec
;;
#ifdef BFD64
- sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
+ sparcv9-*-solaris2.[7-9]* | sparcv9-*-solaris2.1[01]* | \
+ sparc64-*-solaris2.[7-9]* | sparc64-*-solaris2.1[01]*)
# PR 27666: Do not include sparc_elf32_vec or sparc_elf64_vec here.
- targ_defvec=sparc_elf32_sol2_vec
- targ_selvecs="sparc_elf64_sol2_vec"
+ targ_defvec=sparc_elf64_sol2_vec
+ targ_selvecs=sparc_elf32_sol2_vec
want64=true
;;
sparc64-*-haiku*)
run_list_test "code64-inval" "-I${srcdir}/$subdir -al"
}
- if {![istarget "*-*-vxworks*"]} then {
+ if {!([istarget "*-*-solaris2*"] || [istarget "*-*-vxworks*"])} then {
run_dump_test "iamcu-1"
run_dump_test "iamcu-2"
run_dump_test "iamcu-3"
i[3-7]86-*-redox*) targ_emul=elf_i386
targ_extra_emuls=elf_x86_64
;;
-i[3-7]86-*-solaris2*) targ_emul=elf_i386_sol2
- targ_extra_emuls="elf_i386_ldso elf_i386 elf_iamcu elf_x86_64_sol2 elf_x86_64"
+i[3-7]86-*-solaris2.1[01]*)
+ targ_emul=elf_i386_sol2
+ targ_extra_emuls="elf_x86_64_sol2 elf_i386 elf_x86_64"
targ_extra_libpath=$targ_extra_emuls
;;
-i[3-7]86-*-solaris*) targ_emul=elf_i386_ldso
- targ_extra_emuls="elf_i386"
+i[3-7]86-*-solaris2.[0-9]*)
+ targ_emul=elf_i386_sol2
+ targ_extra_emuls=elf_i386
targ_extra_libpath=$targ_extra_emuls
;;
i[3-7]86-*-netbsd* | \
sparc64-*-*bsd*) targ_emul=elf64_sparc
targ_extra_emuls="elf32_sparc"
;;
-sparc64-*-solaris2* | sparcv9-*-solaris2*)
+sparc64-*-solaris2.[7-9]* | sparc64-*-solaris2.1[01]* | \
+sparcv9-*-solaris2.[7-9]* | sparcv9-*-solaris2.1[01]*)
targ_emul=elf64_sparc_sol2
- targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
+ targ_extra_emuls="elf32_sparc_sol2 elf64_sparc elf32_sparc"
targ_extra_libpath=$targ_extra_emuls
- tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
;;
sparc64-*-haiku*) targ_emul=elf64_sparc
;;
targ_extra_libpath=elf64_sparc
tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
;;
-sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
+sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*)
targ_emul=elf32_sparc_sol2
- targ_extra_emuls=elf32_sparc
- ;;
-sparc-*-solaris2*) targ_emul=elf32_sparc_sol2
- targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
+ targ_extra_emuls="elf64_sparc_sol2 elf32_sparc elf64_sparc"
targ_extra_libpath=$targ_extra_emuls
- tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
+ ;;
+sparc-*-solaris2.[0-6]*)
+ targ_emul=elf32_sparc_sol2
+ targ_extra_emuls=elf32_sparc
;;
sparc*-*-vxworks*) targ_emul=elf32_sparc_vxworks
;;
x86_64-*-redox*) targ_emul=elf_x86_64
targ_extra_emuls=elf_i386
;;
-x86_64-*-solaris2*) targ_emul=elf_x86_64_sol2
- targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
+x86_64-*-solaris2.1[01]*)
+ targ_emul=elf_x86_64_sol2
+ targ_extra_emuls="elf_i386_sol2 elf_x86_64 elf_i386"
targ_extra_libpath=$targ_extra_emuls
- tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
;;
x86_64-*-netbsd* | x86_64-*-openbsd*)
targ_emul=elf_x86_64
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
-i[3-7]86-*-solaris*)
- NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
- ;;
-
i[3-7]86-pc-interix*)
NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
;;
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;;
-sparc*-*-solaris2*)
- NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
- ;;
-
spu-*-elf*)
# This allows one to build a pair of PPU/SPU toolchains with common sysroot.
NATIVE_LIB_DIRS='/lib'
source_sh ${srcdir}/emulparams/solaris2.sh
EXTRA_EM_FILE=solaris2
OUTPUT_FORMAT="elf32-sparc-sol2"
+ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
esac
fi
-# Linux and Solaris modify the default library search path
+# Linux modifies the default library search path
# to first include a 64-bit specific directory. It's put
# in slightly different places on the two systems.
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
-# on Linux and /lib/sparcv9, /usr/lib/sparcv9 etc. on Solaris.
+# on Linux.
case "$EMULATION_NAME" in
*64*)
case "$target" in
sparc*-linux*)
LIBPATH_SUFFIX=64 ;;
- sparc*-solaris*)
- LIBPATH_SUFFIX=/sparcv9 ;;
esac
;;
esac
TEXT_START_ADDR=0x100000000
EXTRA_EM_FILE=solaris2
OUTPUT_FORMAT="elf64-sparc-sol2"
+LIBPATH_SUFFIX=/sparcv9
+LIBPATH_SKIP_NONNATIVE=yes
+ELF_INTERPRETER_NAME=\"/usr/lib/sparcv9/ld.so.1\"
+++ /dev/null
-source_sh ${srcdir}/emulparams/plt_unwind.sh
-source_sh ${srcdir}/emulparams/extern_protected_data.sh
-source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh
-source_sh ${srcdir}/emulparams/call_nop.sh
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-i386"
-EXTRA_EM_FILE="elf-x86"
-NO_RELA_RELOCS=yes
-TEXT_START_ADDR=0x08048000
-MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-ARCH=i386
-MACHINE=
-TEMPLATE_NAME=elf
-GENERATE_SHLIB_SCRIPT=yes
-ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
-NO_SMALL_DATA=yes
-source_sh ${srcdir}/emulparams/elf_i386_ldso.sh
+source_sh ${srcdir}/emulparams/elf_i386.sh
source_sh ${srcdir}/emulparams/solaris2.sh
EXTRA_EM_FILE="solaris2-x86"
OUTPUT_FORMAT="elf32-i386-sol2"
+ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
esac
fi
-# Linux/Solaris modify the default library search path to first include
-# a 64-bit specific directory.
+# Linux modifies the default library search path to first include a 64-bit
+# specific directory.
case "$target" in
x86_64*-linux*|i[3-7]86-*-linux-*)
case "$EMULATION_NAME" in
;;
esac
;;
- *-*-solaris2*)
- LIBPATH_SUFFIX=/amd64
- ELF_INTERPRETER_NAME=\"/lib/amd64/ld.so.1\"
- ;;
esac
source_sh ${srcdir}/emulparams/solaris2.sh
EXTRA_EM_FILE="solaris2-x86-64"
OUTPUT_FORMAT="elf64-x86-64-sol2"
+LIBPATH_SUFFIX=/amd64
+LIBPATH_SKIP_NONNATIVE=yes
+ELF_INTERPRETER_NAME=\"/usr/lib/amd64/ld.so.1\"
# File, p.63.
TEXT_START_SYMBOLS='_START_ = .;'
OTHER_END_SYMBOLS='_END_ = .;'
-# Beginning with Solaris 11.x and Solaris 12, there's PIE support.
+# Beginning with Solaris 11.2, there's PIE support.
GENERATE_PIE_SCRIPT=yes
# Otherwise, the default is set here.
#
# The format is the usual list of colon-separated directories.
-# To force a logically empty LIB_PATH, do LIBPATH=":".
+# To force a logically empty LIB_PATH, do LIB_PATH=":".
#
# If we are using a sysroot, prefix library paths with "=" to indicate this.
#
fi ;;
esac
done
- if test "${skip_lib}" = "no"; then
+
+ if test "${skip_lib}" = "no" && test "${LIBPATH_SKIP_NONNATIVE}" != "yes"; then
case :${lib_path1}:${lib_path2}: in
*:${lib}:*) ;;
*::) lib_path2=${lib} ;;
}
# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native
-# except when LIBPATH=":".
+# except when LIB_PATH=":".
if [ "${LIB_PATH}" != ":" ] ; then
libs=
if [ "x${TOOL_LIB}" = "x" ] ; then