From 5c383f026242d25a3c21fdfda42e5ca218b346c8 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 22 Sep 2015 11:12:51 +0200 Subject: [PATCH] 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] : Set DF_1_PIE. binutils: * readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE. --- binutils/ChangeLog | 4 ++++ binutils/readelf.c | 10 ++++++++++ include/elf/ChangeLog | 4 ++++ include/elf/common.h | 2 ++ ld/ChangeLog | 8 ++++++++ ld/emulparams/solaris2.sh | 2 ++ ld/emultempl/elf32.em | 8 ++++++++ 7 files changed, 38 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1e1ccd4b0f..13f216652b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2015-09-22 Rainer Orth + + * readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE. + 2015-09-10 Erik Ackermann * strings.c: Add -s/--output-separator option to specify custom diff --git a/binutils/readelf.c b/binutils/readelf.c index 12fb415eee..4d19e6fb13 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -9241,6 +9241,16 @@ process_dynamic_section (FILE * file) printf (" SINGLETON"); val ^= DF_1_SINGLETON; } + if (val & DF_1_STUB) + { + printf (" STUB"); + val ^= DF_1_STUB; + } + if (val & DF_1_PIE) + { + printf (" PIE"); + val ^= DF_1_PIE; + } if (val != 0) printf (" %lx", val); puts (""); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 47d6bad017..8e6bb445be 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2015-09-22 Rainer Orth + + * common.h (DF_1_STUB, DF_1_PIE): Define. + 2015-09-21 H.J. Lu * external.h (Elf64_External_Chdr): Change ch_type to 4 bytes diff --git a/include/elf/common.h b/include/elf/common.h index e6d8c14d3a..fbf1f3c02f 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -867,6 +867,8 @@ #define DF_1_SYMINTPOSE 0x00800000 #define DF_1_GLOBAUDIT 0x01000000 #define DF_1_SINGLETON 0x02000000 +#define DF_1_STUB 0x04000000 +#define DF_1_PIE 0x08000000 /* Flag values for the DT_FLAGS entry. */ #define DF_ORIGIN (1 << 0) diff --git a/ld/ChangeLog b/ld/ChangeLog index a5f1cd793a..88a46c5fce 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2015-09-22 Rainer Orth + + * emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes. + + * emultempl/elf32.em: Include ldlex.h. + (gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT] + : Set DF_1_PIE. + 2015-09-22 Alan Modra * ld.texinfo: Put --dotsyms/--no-dotsyms on separate lines. diff --git a/ld/emulparams/solaris2.sh b/ld/emulparams/solaris2.sh index dabbb05d0c..aa976f8184 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 7fe90894e8..5fe576ea48 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -49,6 +49,7 @@ fragment <