summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils-2.17/ld/ldmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/binutils-2.17/ld/ldmain.c')
-rw-r--r--gnu/usr.bin/binutils-2.17/ld/ldmain.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils-2.17/ld/ldmain.c b/gnu/usr.bin/binutils-2.17/ld/ldmain.c
index e948d8b4560..246224072fc 100644
--- a/gnu/usr.bin/binutils-2.17/ld/ldmain.c
+++ b/gnu/usr.bin/binutils-2.17/ld/ldmain.c
@@ -271,7 +271,11 @@ main (int argc, char **argv)
link_info.emitrelocations = FALSE;
link_info.task_link = FALSE;
link_info.shared = FALSE;
+#ifdef PIE_DEFAULT
+ link_info.pie = TRUE;
+#else
link_info.pie = FALSE;
+#endif
link_info.executable = FALSE;
link_info.symbolic = FALSE;
link_info.export_dynamic = FALSE;
@@ -338,6 +342,14 @@ main (int argc, char **argv)
ldemul_set_symbols ();
+ if (! link_info.shared && link_info.pie)
+ {
+ if (link_info.relocatable)
+ link_info.pie = FALSE;
+ else
+ link_info.shared = TRUE;
+ }
+
if (link_info.relocatable)
{
if (link_info.gc_sections)