Don't enable new dtags by default with -rpath

ld/

2013-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15096
	* emultempl/alphaelf.em (alpha_after_parse): Call
	gld${EMULATION_NAME}_after_parse instead of after_parse_default.
	* emultempl/cr16elf.em (cr16elf_after_parse): Likewise.
	* emultempl/crxelf.em (crxelf_after_parse): Likewise.
	* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
	* emultempl/mipself.em (mips_after_parse): Likewise.

	* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse): Renamed
	to ...
	(gld_${EMULATION_NAME}_after_parse): This.  Call
	gld${EMULATION_NAME}_after_parse instead of after_parse_default.
	(LDEMUL_AFTER_PARSE): Set to gld_${EMULATION_NAME}_after_parse.

	* emultempl/elf32.em (new_dtags_set): New variable.
	(gld${EMULATION_NAME}_before_parse): Don't set link_info.new_dtags
	here.
	(gld${EMULATION_NAME}_after_parse): New function.
	(ld_${EMULATION_NAME}_emulation): Replace after_parse_default'
	with gld${EMULATION_NAME}_after_parse.
	(gld${EMULATION_NAME}_handle_option): Set new_dtags_set to TRUE
	when setting link_info.new_dtags.

ld/testsuite/

2013-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15096
	* ld-elf/new-dtags-1.d: New test.
	* ld-elf/new-dtags-2.d: Likewise.
	* ld-elf/new-dtags-3.d: Likewise.
	* ld-elf/new-dtags-4.d: Likewise.
	* ld-elf/new-dtags-5.d: Likewise.
	* ld-elf/new-dtags-6.d: Likewise.
	* ld-elf/new-dtags-7.d: Likewise.
	* ld-elf/new-dtags-8.d: Likewise.
This commit is contained in:
H.J. Lu
2013-02-05 01:36:05 +00:00
parent 0f87a16693
commit 663fa5434e
17 changed files with 147 additions and 11 deletions

View File

@ -1,3 +1,28 @@
2013-02-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15096
* emultempl/alphaelf.em (alpha_after_parse): Call
gld${EMULATION_NAME}_after_parse instead of after_parse_default.
* emultempl/cr16elf.em (cr16elf_after_parse): Likewise.
* emultempl/crxelf.em (crxelf_after_parse): Likewise.
* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
* emultempl/mipself.em (mips_after_parse): Likewise.
* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse): Renamed
to ...
(gld_${EMULATION_NAME}_after_parse): This. Call
gld${EMULATION_NAME}_after_parse instead of after_parse_default.
(LDEMUL_AFTER_PARSE): Set to gld_${EMULATION_NAME}_after_parse.
* emultempl/elf32.em (new_dtags_set): New variable.
(gld${EMULATION_NAME}_before_parse): Don't set link_info.new_dtags
here.
(gld${EMULATION_NAME}_after_parse): New function.
(ld_${EMULATION_NAME}_emulation): Replace after_parse_default'
with gld${EMULATION_NAME}_after_parse.
(gld${EMULATION_NAME}_handle_option): Set new_dtags_set to TRUE
when setting link_info.new_dtags.
2013-01-25 Kai Tietz <ktietz@redhat.com>
* deffilep.y (def_image_name): Adjust type of base-address

View File

@ -80,7 +80,7 @@ alpha_after_parse (void)
exp_nameop (SIZEOF_HEADERS, NULL)),
NULL);
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
static void

View File

@ -119,7 +119,7 @@ cr16elf_after_parse (void)
is true the link sometimes fails. */
config.magic_demand_paged = FALSE;
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
/* This is called after the sections have been attached to output

View File

@ -43,7 +43,7 @@ crxelf_after_parse (void)
is true the link sometimes fails. */
config.magic_demand_paged = FALSE;
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
/* This is called after the sections have been attached to output

View File

@ -63,6 +63,7 @@ fragment <<EOF
/* Declare functions used by various EXTRA_EM_FILEs. */
static void gld${EMULATION_NAME}_before_parse (void);
static void gld${EMULATION_NAME}_after_parse (void);
static void gld${EMULATION_NAME}_after_open (void);
static void gld${EMULATION_NAME}_before_allocation (void);
static void gld${EMULATION_NAME}_after_allocation (void);
@ -70,6 +71,15 @@ static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan
(asection *, const char *, int);
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
fragment <<EOF
/* TRUE if link_info.new_dtags is set. */
static bfd_boolean new_dtags_set;
EOF
fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
case ${target} in
*-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
@ -105,16 +115,35 @@ gld${EMULATION_NAME}_before_parse (void)
input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
}
EOF
fi
fragment <<EOF
static void
gld${EMULATION_NAME}_after_parse (void)
{
EOF
if test x"$LDEMUL_AFTER_PARSE" != xgld"$EMULATION_NAME"_after_parse; then
# Enable the "new" dtags by default only for Linux target emulation if
# -rpath isn't used.
case ${target} in
*-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*)
fragment <<EOF
link_info.new_dtags = TRUE;
case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*)
fragment <<EOF
if (!new_dtags_set && command_line.rpath == NULL)
link_info.new_dtags = TRUE;
EOF
;;
esac
;;
esac
fragment <<EOF
after_parse_default ();
}
EOF
@ -2227,10 +2256,12 @@ fragment <<EOF
case OPTION_DISABLE_NEW_DTAGS:
link_info.new_dtags = FALSE;
new_dtags_set = TRUE;
break;
case OPTION_ENABLE_NEW_DTAGS:
link_info.new_dtags = TRUE;
new_dtags_set = TRUE;
break;
case OPTION_EH_FRAME_HDR:
@ -2515,7 +2546,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
${LDEMUL_SYSLIB-syslib_default},
${LDEMUL_HLL-hll_default},
${LDEMUL_AFTER_PARSE-after_parse_default},
${LDEMUL_AFTER_PARSE-gld${EMULATION_NAME}_after_parse},
${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open},
${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation},
${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},

View File

@ -60,7 +60,7 @@ hppaelf_after_parse (void)
NULL);
*/
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
/* This is called before the input files are opened. We create a new

View File

@ -31,12 +31,12 @@ fragment <<EOF
static int itanium = 0;
static void
gld${EMULATION_NAME}_after_parse (void)
gld_${EMULATION_NAME}_after_parse (void)
{
link_info.relax_pass = 2;
bfd_elf${ELFSIZE}_ia64_after_parse (itanium);
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
EOF
@ -61,5 +61,5 @@ PARSE_AND_LIST_ARGS_CASES='
break;
'
LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
LDEMUL_AFTER_PARSE=gld_${EMULATION_NAME}_after_parse
source_em ${srcdir}/emultempl/needrelax.em

View File

@ -45,7 +45,7 @@ mips_after_parse (void)
link_info.emit_hash = TRUE;
link_info.emit_gnu_hash = FALSE;
}
after_parse_default ();
gld${EMULATION_NAME}_after_parse ();
}
struct hook_stub_info

View File

@ -1,3 +1,15 @@
2013-02-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15096
* ld-elf/new-dtags-1.d: New test.
* ld-elf/new-dtags-2.d: Likewise.
* ld-elf/new-dtags-3.d: Likewise.
* ld-elf/new-dtags-4.d: Likewise.
* ld-elf/new-dtags-5.d: Likewise.
* ld-elf/new-dtags-6.d: Likewise.
* ld-elf/new-dtags-7.d: Likewise.
* ld-elf/new-dtags-8.d: Likewise.
2013-01-31 Alan Modra <amodra@gmail.com>
* ld-powerpc/tlsexe.d: Update for changed stub names.

View File

@ -0,0 +1,9 @@
#source: start.s
#readelf: -d -W
#ld: -shared -rpath .
#target: *-*-linux* *-*-gnu*
#failif
#...
+0x[0-9a-f]+ +\(RUNPATH\) +Library runpath: +\[.\]
#...

View File

@ -0,0 +1,8 @@
#source: start.s
#readelf: -d -W
#ld: -shared -rpath .
#target: *-*-linux* *-*-gnu*
#...
+0x[0-9a-f]+ +\(RPATH\) +Library rpath: +\[.\]
#pass

View File

@ -0,0 +1,9 @@
#source: start.s
#readelf: -d -W
#ld: -shared -rpath . --enable-new-dtags
#target: *-*-linux* *-*-gnu*
#failif
#...
+0x[0-9a-f]+ +\(RPATH\) +Library rpath: +\[.\]
#...

View File

@ -0,0 +1,8 @@
#source: start.s
#readelf: -d -W
#ld: -shared -rpath . --enable-new-dtags
#target: *-*-linux* *-*-gnu*
#...
+0x[0-9a-f]+ +\(RUNPATH\) +Library runpath: +\[.\]
#pass

View File

@ -0,0 +1,9 @@
#source: start.s
#readelf: -d -W
#ld: -shared -z now
#target: *-*-linux* *-*-gnu*
#failif
#...
0x[0-9a-f]+ +\(BIND_NOW\) +
#...

View File

@ -0,0 +1,8 @@
#source: start.s
#readelf: -d -W
#ld: -shared -z now
#target: *-*-linux* *-*-gnu*
#...
0x[0-9a-f]+ +\(FLAGS\) +BIND_NOW
#pass

View File

@ -0,0 +1,9 @@
#source: start.s
#readelf: -d -W
#ld: -shared -z now --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#failif
#...
0x[0-9a-f]+ +\(FLAGS\) +BIND_NOW
#pass

View File

@ -0,0 +1,8 @@
#source: start.s
#readelf: -d -W
#ld: -shared -z now --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#...
0x[0-9a-f]+ +\(BIND_NOW\) +
#pass