aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2015-09-22 11:12:51 +0200
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2015-09-22 11:12:51 +0200
commit5c383f026242d25a3c21fdfda42e5ca218b346c8 (patch)
treed854510497f70338583a6b6c6ca22abb91d9279b /ld
parent6dca4fd141fd0b9fe0ea662295833b8ed43cb4e8 (diff)
downloadgdb-5c383f026242d25a3c21fdfda42e5ca218b346c8.zip
gdb-5c383f026242d25a3c21fdfda42e5ca218b346c8.tar.gz
gdb-5c383f026242d25a3c21fdfda42e5ca218b346c8.tar.bz2
Solaris PIE support
include/elf: * common.h (DF_1_STUB, DF_1_PIE): Define. ld: * emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes. * emultempl/elf32.em: Include ldlex.h. (gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT] <OPTION_PIE>: Set DF_1_PIE. binutils: * readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/emulparams/solaris2.sh2
-rw-r--r--ld/emultempl/elf32.em8
3 files changed, 18 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a5f1cd7..88a46c5 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2015-09-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.
+
+ * emultempl/elf32.em: Include ldlex.h.
+ (gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
+ <OPTION_PIE>: Set DF_1_PIE.
+
2015-09-22 Alan Modra <amodra@gmail.com>
* ld.texinfo: Put --dotsyms/--no-dotsyms on separate lines.
diff --git a/ld/emulparams/solaris2.sh b/ld/emulparams/solaris2.sh
index dabbb05..aa976f8 100644
--- a/ld/emulparams/solaris2.sh
+++ b/ld/emulparams/solaris2.sh
@@ -8,3 +8,5 @@
# File, p.63.
TEXT_START_SYMBOLS='_START_ = .;'
OTHER_END_SYMBOLS='_END_ = .;'
+# Beginning with Solaris 11.x and Solaris 12, there's PIE support.
+GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 7fe9089..5fe576e 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -49,6 +49,7 @@ fragment <<EOF
#include "ldmain.h"
#include "ldmisc.h"
#include "ldexp.h"
+#include "ldlex.h"
#include "ldlang.h"
#include "ldfile.h"
#include "ldemul.h"
@@ -2289,6 +2290,13 @@ fragment <<EOF
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)