[build] Support --sysroot with Solaris ld
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Wed May 31 12:01:00 GMT 2017
The Solaris linker recently gained sysroot support. The following patch
enables that, although there isn't much to do:
* Until recently, ld --help output went to stderr, not being caught by
gcc/configure's tests which only checked stdout. However, older ld
versions still differ here and libtool long has been checking both
stdout and stderr, so this seems a pretty obvious change to me.
The only point worth mentioning is that I've guarded the --as-needed
check for non-GNU ld: before, the native Solaris -z ignore/-z record
forms were used, now this would use the compat options
--as-needed/--no-as-needed which occur in the --help output.
* While Solaris ld *does* support --sysroot for gld compatibility, we've
always preferred the native forms of the options, -z sysroot in this
case, which the sol2.h part of the patch implements.
Tested in i386-pc-solaris2.12 and sparc-sun-solaris2.12 builds with both
ld and gld, checking that auto-host.h has no unexpected changes.
Also tested with i386-pc-solaris2.12 x sparc-sun-solaris2.12 and
sparc-sun-solaris2.12 x i386-pc-solaris2.12 crosses with both ld (which
has been a cross-linker for quite some time) and gld, checking that -z
sysroot/--sysroot was used as expected.
Ok for mainline?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2017-05-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_ld_static_dynamic): Also check stderr for
$gcc_cv_ld --help output.
(gcc_cv_ld_demangle): Likewise.
(gcc_cv_ld_eh_frame_hdr): Likewise.
(gcc_cv_ld_pie): Likewise.
(gcc_cv_ld_as_needed): Likewise. Prefer native forms unless $gnu_ld.
(gcc_cv_ld_buildid): Likewise.
(gcc_cv_ld_sysroot): Likewise.
(ld_bndplt_support): Likewise.
(ld_pushpopstate_support): Likewise.
* configure: Regenerate.
* config/sol2.h [!USE_GLD] (SYSROOT_SPEC): Define.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-ld-sysroot.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170531/c721807b/attachment.bin>
More information about the Gcc-patches
mailing list