Skip to content

Commit 5c383f0

Browse files
committed
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.
1 parent 6dca4fd commit 5c383f0

File tree

7 files changed

+38
-0
lines changed

7 files changed

+38
-0
lines changed

binutils/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015-09-22 Rainer Orth <[email protected]>
2+
3+
* readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE.
4+
15
2015-09-10 Erik Ackermann <[email protected]>
26

37
* strings.c: Add -s/--output-separator option to specify custom

binutils/readelf.c

+10
Original file line numberDiff line numberDiff line change
@@ -9241,6 +9241,16 @@ process_dynamic_section (FILE * file)
92419241
printf (" SINGLETON");
92429242
val ^= DF_1_SINGLETON;
92439243
}
9244+
if (val & DF_1_STUB)
9245+
{
9246+
printf (" STUB");
9247+
val ^= DF_1_STUB;
9248+
}
9249+
if (val & DF_1_PIE)
9250+
{
9251+
printf (" PIE");
9252+
val ^= DF_1_PIE;
9253+
}
92449254
if (val != 0)
92459255
printf (" %lx", val);
92469256
puts ("");

include/elf/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015-09-22 Rainer Orth <[email protected]>
2+
3+
* common.h (DF_1_STUB, DF_1_PIE): Define.
4+
15
2015-09-21 H.J. Lu <[email protected]>
26

37
* external.h (Elf64_External_Chdr): Change ch_type to 4 bytes

include/elf/common.h

+2
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@
867867
#define DF_1_SYMINTPOSE 0x00800000
868868
#define DF_1_GLOBAUDIT 0x01000000
869869
#define DF_1_SINGLETON 0x02000000
870+
#define DF_1_STUB 0x04000000
871+
#define DF_1_PIE 0x08000000
870872

871873
/* Flag values for the DT_FLAGS entry. */
872874
#define DF_ORIGIN (1 << 0)

ld/ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2015-09-22 Rainer Orth <[email protected]>
2+
3+
* emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.
4+
5+
* emultempl/elf32.em: Include ldlex.h.
6+
(gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
7+
<OPTION_PIE>: Set DF_1_PIE.
8+
19
2015-09-22 Alan Modra <[email protected]>
210

311
* ld.texinfo: Put --dotsyms/--no-dotsyms on separate lines.

ld/emulparams/solaris2.sh

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
# File, p.63.
99
TEXT_START_SYMBOLS='_START_ = .;'
1010
OTHER_END_SYMBOLS='_END_ = .;'
11+
# Beginning with Solaris 11.x and Solaris 12, there's PIE support.
12+
GENERATE_PIE_SCRIPT=yes

ld/emultempl/elf32.em

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fragment <<EOF
4949
#include "ldmain.h"
5050
#include "ldmisc.h"
5151
#include "ldexp.h"
52+
#include "ldlex.h"
5253
#include "ldlang.h"
5354
#include "ldfile.h"
5455
#include "ldemul.h"
@@ -2289,6 +2290,13 @@ fragment <<EOF
22892290

22902291
EOF
22912292
fi
2293+
if test x"$GENERATE_PIE_SCRIPT" = xyes; then
2294+
fragment <<EOF
2295+
case OPTION_PIE:
2296+
link_info.flags_1 |= (bfd_vma) DF_1_PIE;
2297+
break;
2298+
EOF
2299+
fi
22922300
fragment <<EOF
22932301
case 'z':
22942302
if (strcmp (optarg, "defs") == 0)

0 commit comments

Comments
 (0)