* [PATCH] backport FreeBSD add functionality to build PIE executables
@ 2015-06-23 17:29 Andreas Tobler
2015-06-23 17:58 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Tobler @ 2015-06-23 17:29 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
Hi all,
I'm going to commit this patch to 5.1 in the next days unless someone
objects.
The patch is in my 5.1 tree since a longer time and I regularly post
results.
Thanks,
Andreas
2015-06-22 Andreas Tobler <andreast@gcc.gnu.org>
Backport from mainline
2015-05-18 Andreas Tobler <andreast@gcc.gnu.org>
* config/freebsd-spec.h (FBSD_STARTFILE_SPEC): Add the bits to build
pie executables.
(FBSD_ENDFILE_SPEC): Likewise.
* config/i386/freebsd.h (STARTFILE_SPEC): Remove and use the one from
config/freebsd-spec.h.
(ENDFILE_SPEC): Likewise.
2015-06-22 Andreas Tobler <andreast@gcc.gnu.org>
Backport from mainline
2015-05-12 Andreas Tobler <andreast@gcc.gnu.org>
* lib/target-supports.exp (check_effective_target_pie): Add *-*-freebsd*
to the family of pie capable targets.
[-- Attachment #2: gcc5-fbsd-pie.diff --]
[-- Type: text/plain, Size: 3068 bytes --]
Index: config/freebsd-spec.h
===================================================================
--- config/freebsd-spec.h (revision 224751)
+++ config/freebsd-spec.h (working copy)
@@ -66,8 +66,9 @@
"%{!shared: \
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
%{!p:%{profile:gcrt1.o%s} \
- %{!profile:crt1.o%s}}}} \
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+ %{!profile: \
+ %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
the magical crtend.o file (see crtstuff.c) which provides part of
@@ -76,7 +77,7 @@
`crtn.o'. */
#define FBSD_ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
/* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
required by the user-land thread model. Before __FreeBSD_version
Index: config/i386/freebsd.h
===================================================================
--- config/i386/freebsd.h (revision 224751)
+++ config/i386/freebsd.h (working copy)
@@ -59,29 +59,16 @@
#define SUBTARGET_EXTRA_SPECS \
{ "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
-/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
- the magical crtbegin.o file (see crtstuff.c) which provides part
- of the support for getting C++ file-scope static object constructed
- before entering `main'. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
- %{!p:%{profile:gcrt1.o%s} \
- %{!profile:crt1.o%s}}}} \
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+/* Use the STARTFILE_SPEC from config/freebsd-spec.h. */
-/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
- the magical crtend.o file (see crtstuff.c) which provides part of
- the support for getting C++ file-scope static object constructed
- before entering `main', followed by a normal "finalizer" file,
- `crtn.o'. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC FBSD_STARTFILE_SPEC
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+/* Use the ENDFILE_SPEC from config/freebsd-spec.h. */
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC FBSD_ENDFILE_SPEC
+
/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
for the special GCC options -static and -shared, which allow us to
link things in one of these three modes by applying the appropriate
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp (revision 224751)
+++ testsuite/lib/target-supports.exp (working copy)
@@ -952,6 +952,7 @@
proc check_effective_target_pie { } {
if { [istarget *-*-darwin\[912\]*]
+ || [istarget *-*-freebsd*]
|| [istarget *-*-linux*]
|| [istarget *-*-gnu*] } {
return 1;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] backport FreeBSD add functionality to build PIE executables
2015-06-23 17:29 [PATCH] backport FreeBSD add functionality to build PIE executables Andreas Tobler
@ 2015-06-23 17:58 ` Jakub Jelinek
2015-06-23 18:00 ` Andreas Tobler
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2015-06-23 17:58 UTC (permalink / raw)
To: Andreas Tobler; +Cc: GCC Patches
On Tue, Jun 23, 2015 at 07:26:09PM +0200, Andreas Tobler wrote:
> Hi all,
>
> I'm going to commit this patch to 5.1 in the next days unless someone
> objects.
>
> The patch is in my 5.1 tree since a longer time and I regularly post
> results.
Note, Richard announced plan to do 5.2-rc2 on July, 3rd, so either you
should do that before, or after 5.2 is released (general comment for all the
patches). Or you'd need an exception when the branch is frozen.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] backport FreeBSD add functionality to build PIE executables
2015-06-23 17:58 ` Jakub Jelinek
@ 2015-06-23 18:00 ` Andreas Tobler
2015-06-23 19:02 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Tobler @ 2015-06-23 18:00 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches
On 23.06.15 19:50, Jakub Jelinek wrote:
> On Tue, Jun 23, 2015 at 07:26:09PM +0200, Andreas Tobler wrote:
>> Hi all,
>>
>> I'm going to commit this patch to 5.1 in the next days unless someone
>> objects.
>>
>> The patch is in my 5.1 tree since a longer time and I regularly post
>> results.
>
> Note, Richard announced plan to do 5.2-rc2 on July, 3rd, so either you
> should do that before, or after 5.2 is released (general comment for all the
> patches). Or you'd need an exception when the branch is frozen.
With 'in the next days' I meant to say 26.6 latest. Is this early enough?
I'm ready to commit right now, but I wanted to give people some time to
object :)
Thank you!
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] backport FreeBSD add functionality to build PIE executables
2015-06-23 18:00 ` Andreas Tobler
@ 2015-06-23 19:02 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2015-06-23 19:02 UTC (permalink / raw)
To: Andreas Tobler; +Cc: GCC Patches
On Tue, Jun 23, 2015 at 07:58:48PM +0200, Andreas Tobler wrote:
> On 23.06.15 19:50, Jakub Jelinek wrote:
> >On Tue, Jun 23, 2015 at 07:26:09PM +0200, Andreas Tobler wrote:
> >>Hi all,
> >>
> >>I'm going to commit this patch to 5.1 in the next days unless someone
> >>objects.
> >>
> >>The patch is in my 5.1 tree since a longer time and I regularly post
> >>results.
> >
> >Note, Richard announced plan to do 5.2-rc2 on July, 3rd, so either you
> >should do that before, or after 5.2 is released (general comment for all the
> >patches). Or you'd need an exception when the branch is frozen.
>
> With 'in the next days' I meant to say 26.6 latest. Is this early enough?
26.6. < 3.7., so sure, it is ok ;)
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-23 18:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 17:29 [PATCH] backport FreeBSD add functionality to build PIE executables Andreas Tobler
2015-06-23 17:58 ` Jakub Jelinek
2015-06-23 18:00 ` Andreas Tobler
2015-06-23 19:02 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).