summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-02-05 14:31:33 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-02-05 14:31:33 +0000
commiteafbfecfba57718a24c0bd9814e1166fe97dbd14 (patch)
treedcb7c4c9fd8d9fc98eb83554696ee251e8750cf3 /gnu/usr.bin
parent9ab126405989913e3609ef0eb5688bcf593c6fbc (diff)
Disable PIE-by-default if -static (or one of its aliases) is passed on the
command line. While technically -static only controls whether we link against static libraries, people expect that doing so produces a fully static binary. tested by sthen@ ok pascal@, miod@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/binutils-2.17/ld/lexsup.c2
-rw-r--r--gnu/usr.bin/binutils/ld/lexsup.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils-2.17/ld/lexsup.c b/gnu/usr.bin/binutils-2.17/ld/lexsup.c
index 654edb52f27..6df8c2110f8 100644
--- a/gnu/usr.bin/binutils-2.17/ld/lexsup.c
+++ b/gnu/usr.bin/binutils-2.17/ld/lexsup.c
@@ -722,6 +722,8 @@ parse_args (unsigned argc, char **argv)
break;
case OPTION_NON_SHARED:
config.dynamic_link = FALSE;
+ if (! link_info.shared)
+ link_info.pie = FALSE;
break;
case OPTION_CREF:
command_line.cref = TRUE;
diff --git a/gnu/usr.bin/binutils/ld/lexsup.c b/gnu/usr.bin/binutils/ld/lexsup.c
index dbcb19880cf..68384f4330f 100644
--- a/gnu/usr.bin/binutils/ld/lexsup.c
+++ b/gnu/usr.bin/binutils/ld/lexsup.c
@@ -649,6 +649,8 @@ parse_args (unsigned argc, char **argv)
break;
case OPTION_NON_SHARED:
config.dynamic_link = FALSE;
+ if (! link_info.shared)
+ link_info.pie = FALSE;
break;
case OPTION_CREF:
command_line.cref = TRUE;