echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xdo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xso >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
fi
echo ' ; else if (link_info.combreloc && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c
fi
&& link_info.relro
&& (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xdw";
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc
+ && link_info.relro)
+ return "ldscripts/${EMULATION_NAME}.xdo";
+EOF
+fi
+fragment <<EOF
else if (bfd_link_pie (&link_info)
&& link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xdc";
else if (bfd_link_dll (&link_info) && link_info.combreloc
&& link_info.relro && (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xsw";
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_dll (&link_info) && link_info.combreloc
+ && link_info.relro)
+ return "ldscripts/${EMULATION_NAME}.xso";
+EOF
+fi
+fragment <<EOF
else if (bfd_link_dll (&link_info) && link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xsc";
EOF
else if (link_info.combreloc && link_info.relro
&& (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xw";
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (link_info.combreloc && link_info.relro)
+ return "ldscripts/${EMULATION_NAME}.xo";
+EOF
+fi
+fragment <<EOF
else if (link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xc";
EOF
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xc
rm -f ${COMBRELOC}
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=o
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xo.tmp
+ ( echo "/* Script for -z combreloc -z relro: combine and sort reloc sections */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xo
+ rm -f ${COMBRELOC}
+ COMBRELOC=
+ unset RELRO
+ fi
+
LD_FLAG=w
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xw.tmp
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsc
rm -f ${COMBRELOC}
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=oshared
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xso.tmp
+ ( echo "/* Script for --shared -z combreloc -z relro: shared library, combine & sort relocs */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xso
+ rm -f ${COMBRELOC}
+ COMBRELOC=
+ unset RELRO
+ fi
+
LD_FLAG=wshared
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xsw.tmp
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdc
rm -f ${COMBRELOC}
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=opie
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdo.tmp
+ ( echo "/* Script for -pie -z combreloc -z relro: position independent executable, combine & sort relocs */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdo
+ rm -f ${COMBRELOC}
+ COMBRELOC=
+ unset RELRO
+ fi
+
LD_FLAG=wpie
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xdw.tmp