This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld -z options
On Thu, Jul 14, 2011 at 03:12:21AM -0400, Hans-Peter Nilsson wrote:
> 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?
I think the test enabling -z relro only when COMMONPAGESIZE is defined
is bogus. Also, all ELF targets should be using the CONSTANT
maxpagesize and commonpagesize, but changing over requires someone to
check that the relevant bfd backend defines ELF_MAXPAGESIZE and
ELF_COMMONPAGESIZE in agreement with their ld couterparts. Right now
I've run out of enthusiasm for that sort of cleanup work.
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option,
gld${EMULATION_NAME}_list_options): Don't condition -z relro
and -z norelro on COMMONPAGESIZE being defined.
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.221
diff -u -p -r1.221 elf32.em
--- ld/emultempl/elf32.em 14 Jul 2011 02:38:43 -0000 1.221
+++ ld/emultempl/elf32.em 14 Jul 2011 10:46:00 -0000
@@ -2323,16 +2323,11 @@ fragment <<EOF
link_info.combreloc = FALSE;
else if (strcmp (optarg, "nocopyreloc") == 0)
link_info.nocopyreloc = TRUE;
-EOF
-
- if test -n "$COMMONPAGESIZE"; then
-fragment <<EOF
else if (strcmp (optarg, "relro") == 0)
link_info.relro = TRUE;
else if (strcmp (optarg, "norelro") == 0)
link_info.relro = FALSE;
EOF
- fi
fi
fragment <<EOF
@@ -2444,27 +2439,17 @@ fragment <<EOF
-z noexecstack Mark executable as not requiring executable stack\n"));
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
- if test -n "$COMMONPAGESIZE"; then
fragment <<EOF
fprintf (file, _("\
-z norelro Don't create RELRO program header\n"));
-EOF
- fi
-
-fragment <<EOF
fprintf (file, _("\
-z now Mark object non-lazy runtime binding\n"));
fprintf (file, _("\
-z origin Mark object requiring immediate \$ORIGIN\n\
processing at runtime\n"));
-EOF
-
- if test -n "$COMMONPAGESIZE"; then
-fragment <<EOF
fprintf (file, _("\
-z relro Create RELRO program header\n"));
EOF
- fi
fi
if test -n "$PARSE_AND_LIST_OPTIONS" ; then
--
Alan Modra
Australia Development Lab, IBM