Link -static -pie executables with rcrt0.o instead of crt0.o such that they
authorkettenis <kettenis@openbsd.org>
Mon, 22 Dec 2014 19:32:49 +0000 (19:32 +0000)
committerkettenis <kettenis@openbsd.org>
Mon, 22 Dec 2014 19:32:49 +0000 (19:32 +0000)
self-relocate.

Based on a diff from kurt@

ok deraadt@

gnu/gcc/gcc/config/i386/openbsd64.h

index 87d2f98..7984fe6 100644 (file)
@@ -44,7 +44,8 @@ Boston, MA 02111-1307, USA.  */
 /* As an elf system, we need crtbegin/crtend stuff.  */
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "\
-       %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+       %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
+       %{!p:%{!static:crt0%O%s} %{static:%{pie:rcrt0%O%s} %{!pie:crt0%O%s}}}} \
        crtbegin%O%s} %{shared:crtbeginS%O%s}"
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"