• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


コミットメタ情報

リビジョン85dd6069e6baac2596d6e9f200d4761eea2169de (tree)
日時2016-06-08 21:07:29
作者Marcin Kościelnicki <koriakin@0x04...>
コミッターMarcin Kościelnicki

ログメッセージ

ld: Enable using separate linker script for -z relro

This will be used for s390 relro got support.

ld/ChangeLog:

* emultempl/elf32.em: Use .xo, .xso, .xdo scripts if
GENERATE_RELRO_SCRIPT is set.
* genscripts.sh: Create .xo, .xso, .xdo scripts if
GENERATE_RELRO_SCRIPT is set.

変更サマリ

差分

--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2074,6 +2074,12 @@ echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
20742074 echo ' && link_info.relro' >> e${EMULATION_NAME}.c
20752075 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
20762076 sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
2077+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2078+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
2079+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
2080+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
2081+sed $sc ldscripts/${EMULATION_NAME}.xdo >> e${EMULATION_NAME}.c
2082+fi
20772083 echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
20782084 echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
20792085 sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
@@ -2087,6 +2093,12 @@ echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc' >> e${EMULA
20872093 echo ' && link_info.relro' >> e${EMULATION_NAME}.c
20882094 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
20892095 sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
2096+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2097+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
2098+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
2099+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
2100+sed $sc ldscripts/${EMULATION_NAME}.xso >> e${EMULATION_NAME}.c
2101+fi
20902102 echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc) return' >> e${EMULATION_NAME}.c
20912103 sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
20922104 fi
@@ -2097,6 +2109,11 @@ if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
20972109 echo ' ; else if (link_info.combreloc && link_info.relro' >> e${EMULATION_NAME}.c
20982110 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
20992111 sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c
2112+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2113+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c
2114+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
2115+sed $sc ldscripts/${EMULATION_NAME}.xo >> e${EMULATION_NAME}.c
2116+fi
21002117 echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c
21012118 sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c
21022119 fi
@@ -2133,6 +2150,16 @@ fragment <<EOF
21332150 && link_info.relro
21342151 && (link_info.flags & DF_BIND_NOW))
21352152 return "ldscripts/${EMULATION_NAME}.xdw";
2153+EOF
2154+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2155+fragment <<EOF
2156+ else if (bfd_link_pie (&link_info)
2157+ && link_info.combreloc
2158+ && link_info.relro)
2159+ return "ldscripts/${EMULATION_NAME}.xdo";
2160+EOF
2161+fi
2162+fragment <<EOF
21362163 else if (bfd_link_pie (&link_info)
21372164 && link_info.combreloc)
21382165 return "ldscripts/${EMULATION_NAME}.xdc";
@@ -2149,6 +2176,15 @@ fragment <<EOF
21492176 else if (bfd_link_dll (&link_info) && link_info.combreloc
21502177 && link_info.relro && (link_info.flags & DF_BIND_NOW))
21512178 return "ldscripts/${EMULATION_NAME}.xsw";
2179+EOF
2180+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2181+fragment <<EOF
2182+ else if (bfd_link_dll (&link_info) && link_info.combreloc
2183+ && link_info.relro)
2184+ return "ldscripts/${EMULATION_NAME}.xso";
2185+EOF
2186+fi
2187+fragment <<EOF
21522188 else if (bfd_link_dll (&link_info) && link_info.combreloc)
21532189 return "ldscripts/${EMULATION_NAME}.xsc";
21542190 EOF
@@ -2163,6 +2199,14 @@ fragment <<EOF
21632199 else if (link_info.combreloc && link_info.relro
21642200 && (link_info.flags & DF_BIND_NOW))
21652201 return "ldscripts/${EMULATION_NAME}.xw";
2202+EOF
2203+if test -n "$GENERATE_RELRO_SCRIPT" ; then
2204+fragment <<EOF
2205+ else if (link_info.combreloc && link_info.relro)
2206+ return "ldscripts/${EMULATION_NAME}.xo";
2207+EOF
2208+fi
2209+fragment <<EOF
21662210 else if (link_info.combreloc)
21672211 return "ldscripts/${EMULATION_NAME}.xc";
21682212 EOF
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -321,6 +321,20 @@ if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
321321 . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
322322 ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xc
323323 rm -f ${COMBRELOC}
324+
325+ if test -n "$GENERATE_RELRO_SCRIPT"; then
326+ LD_FLAG=o
327+ RELRO=" "
328+ COMBRELOC=ldscripts/${EMULATION_NAME}.xo.tmp
329+ ( echo "/* Script for -z combreloc -z relro: combine and sort reloc sections */"
330+ . ${CUSTOMIZER_SCRIPT}
331+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
332+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xo
333+ rm -f ${COMBRELOC}
334+ COMBRELOC=
335+ unset RELRO
336+ fi
337+
324338 LD_FLAG=w
325339 RELRO_NOW=" "
326340 COMBRELOC=ldscripts/${EMULATION_NAME}.xw.tmp
@@ -351,6 +365,20 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; then
351365 . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
352366 ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsc
353367 rm -f ${COMBRELOC}
368+
369+ if test -n "$GENERATE_RELRO_SCRIPT"; then
370+ LD_FLAG=oshared
371+ RELRO=" "
372+ COMBRELOC=ldscripts/${EMULATION_NAME}.xso.tmp
373+ ( echo "/* Script for --shared -z combreloc -z relro: shared library, combine & sort relocs */"
374+ . ${CUSTOMIZER_SCRIPT}
375+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
376+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xso
377+ rm -f ${COMBRELOC}
378+ COMBRELOC=
379+ unset RELRO
380+ fi
381+
354382 LD_FLAG=wshared
355383 RELRO_NOW=" "
356384 COMBRELOC=ldscripts/${EMULATION_NAME}.xsw.tmp
@@ -383,6 +411,20 @@ if test -n "$GENERATE_PIE_SCRIPT"; then
383411 . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
384412 ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdc
385413 rm -f ${COMBRELOC}
414+
415+ if test -n "$GENERATE_RELRO_SCRIPT"; then
416+ LD_FLAG=opie
417+ RELRO=" "
418+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdo.tmp
419+ ( echo "/* Script for -pie -z combreloc -z relro: position independent executable, combine & sort relocs */"
420+ . ${CUSTOMIZER_SCRIPT}
421+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
422+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdo
423+ rm -f ${COMBRELOC}
424+ COMBRELOC=
425+ unset RELRO
426+ fi
427+
386428 LD_FLAG=wpie
387429 RELRO_NOW=" "
388430 COMBRELOC=ldscripts/${EMULATION_NAME}.xdw.tmp