+2015-09-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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/nds32elf.em (nds32_elf_after_parse): Likewise.
+ * emultempl/elf32.em: Don't include ldlex.h.
+ (gld${EMULATION_NAME}_after_parse): New function.
+ (gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
+ <OPTION_PIE>: Removed.
+ (ld_${EMULATION_NAME}_emulation): Replace after_parse_default
+ with gld${EMULATION_NAME}_after_parse.
+ * emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse):
+ Renamed to ...
+ (ia64elf_after_parse): This. Call
+ gld${EMULATION_NAME}_after_parse instead of after_parse_default.
+ (LDEMUL_AFTER_PARSE): Replace gld${EMULATION_NAME}_after_parse
+ with ia64elf_after_parse.
+
2015-09-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.
exp_nameop (SIZEOF_HEADERS, NULL)),
NULL);
- after_parse_default ();
+ gld${EMULATION_NAME}_after_parse ();
}
static 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
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
#include "ldmain.h"
#include "ldmisc.h"
#include "ldexp.h"
-#include "ldlex.h"
#include "ldlang.h"
#include "ldfile.h"
#include "ldemul.h"
/* 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);
EOF
fi
+if test x"$LDEMUL_AFTER_PARSE" != xgld"$EMULATION_NAME"_after_parse; then
+fragment <<EOF
+
+static void
+gld${EMULATION_NAME}_after_parse (void)
+{
+ if (bfd_link_pie (&link_info))
+ link_info.flags_1 |= (bfd_vma) DF_1_PIE;
+
+ after_parse_default ();
+}
+
+EOF
+fi
+
if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then
fragment <<EOF
/* Handle the generation of DT_NEEDED tags. */
EOF
fi
-if test x"$GENERATE_PIE_SCRIPT" = xyes; then
-fragment <<EOF
- case OPTION_PIE:
- link_info.flags_1 |= (bfd_vma) DF_1_PIE;
- break;
-EOF
-fi
fragment <<EOF
case 'z':
if (strcmp (optarg, "defs") == 0)
${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},
NULL);
*/
- after_parse_default ();
+ gld${EMULATION_NAME}_after_parse ();
}
/* This is called before the input files are opened. We create a new
static int itanium = 0;
static void
-gld${EMULATION_NAME}_after_parse (void)
+ia64elf_after_parse (void)
{
link_info.relax_pass = 2;
bfd_elf${ELFSIZE}_ia64_after_parse (itanium);
- after_parse_default ();
+ gld${EMULATION_NAME}_after_parse ();
}
EOF
break;
'
-LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
+LDEMUL_AFTER_PARSE=ia64elf_after_parse
source_em ${srcdir}/emultempl/needrelax.em
link_info.emit_hash = TRUE;
link_info.emit_gnu_hash = FALSE;
}
- after_parse_default ();
+ gld${EMULATION_NAME}_after_parse ();
}
struct hook_stub_info
target_optimize = target_optimize & (!NDS32_RELAX_EX9_ON);
}
- after_parse_default ();
+ gld${EMULATION_NAME}_after_parse ();
}
static void
+2015-09-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/pie.d: New test.
+
2015-09-18 Alan Modra <amodra@gmail.com>
PR ld/18963
--- /dev/null
+#source: start.s
+#readelf: -d -W
+#ld: -pie
+#target: *-*-linux* *-*-gnu* *-*-solaris*
+
+#...
+ +0x[0-9a-f]+ +\(FLAGS_1\) +Flags: +PIE
+#pass