ld -z options
Hans-Peter Nilsson
hp@bitrange.com
Thu Jul 14 08:06:00 GMT 2011
On Thu, 14 Jul 2011, Alan Modra wrote:
> On Wed, Jul 13, 2011 at 04:07:35PM -0700, Ian Lance Taylor wrote:
> > While you're looking at this, how would you feel about making the linker
> > give a warning or error when an unrecognized -z option is used?
>
> Done. A warning seems reasonable. I've also taken out the
> "-z KEYWORD Ignored for Solaris compatibility" help message, and moved
> emultempl/plt_unwind.em to emulparams/plt_unwind.sh so that it doesn't
> conflict with other uses of EXTRA_EM_FILE.
>
> * emultempl/elf32.em (gld${EMULATION_NAME}_add_options,
> gld${EMULATION_NAME}_handle_option, gld${EMULATION_NAME}_list_options):
> Provide --build-id, -z defs, -z muldefs, -z max-page-size,
> -z common-page-size, -z execstack, -z noexecstack for all targets.
> Add help for --exclude-libs.
> (OPTION_LD_GENERATED_UNWIND_INFO,
> OPTION_NO_LD_GENERATED_UNWIND_INFO): Move this..
> (gld${EMULATION_NAME}_handle_option): ..and code handling
> --ld-generated-unwind-info and --no-ld-generated-unwind-info..
> * emulparams/plt_unwind.sh: ..to here. New file. Add help.
> * emulparams/elf32_x86_64.sh: Include plt_unwind.sh.
> * emulparams/elf_i386.sh: Likewise.
> * emulparams/elf_i386_chaos.sh: Likewise.
> * emulparams/elf_i386_ldso.sh: Likewise.
> * emulparams/elf_l1om.sh: Likewise.
> * emulparams/elf_x86_64.sh: Likewise.
This caused several test-cases to go from PASS to UNRESOLVED for
cris-axis-linux-gnu and at a glance in ld.log wrongly so:
+UNRESOLVED: strip -z relro (relro1)
+UNRESOLVED: strip -z relro -shared (relro1)
+UNRESOLVED: objcopy -z relro (relro1)
+UNRESOLVED: objcopy -z relro -shared (relro1)
+UNRESOLVED: objcopy -z relro (tdata1)
+UNRESOLVED: objcopy -shared -z relro (tdata1)
+UNRESOLVED: objcopy -z relro (tdata2)
+UNRESOLVED: objcopy -shared -z relro (tdata2)
+UNRESOLVED: objcopy -z relro (tdata3)
+UNRESOLVED: objcopy -shared -z relro (tdata3)
+UNRESOLVED: objcopy -z relro (tbss1)
+UNRESOLVED: objcopy -shared -z relro (tbss1)
+UNRESOLVED: objcopy -z relro (tbss2)
+UNRESOLVED: objcopy -shared -z relro (tbss2)
+UNRESOLVED: objcopy -z relro (tbss3)
+UNRESOLVED: objcopy -shared -z relro (tbss3)
All preceded by a linker warning ".../ld-new: warning: -z relro
ignored." in ld.log. The UNRESOLVED status then cause the
check-ld to return error. According to the dejagnu docs, the
UNRESOLVED is an indication of an error in the testsuite (likely
the unexpected warning). But why the warning? Didn't -z relro
work before; did the tests accidentally pass before your changes
and I missed something in the port or what's up?
Hm, at a second glance many other ports set
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" which for some reason
triggers the recognition of e.g. "-z relro" but why would I have
to set that when there's just one page-size? Can we default to
that instead? And aren't the tests not really testing -z relro
if they passed anyway? (Ok, it became the default, but then
there's a missing "-z norelro" test IMHO.)
brgds, H-P
More information about the Binutils
mailing list