Switch powerpc to big PIC

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Switch powerpc to big PIC

Mark Kettenis
The architecture already has big PIE.  The issue is that clang doesn't
support secure-plt for small pic.  I haven't entirely figured out
what's going on here and we probably need some further fixes to clang
here.  On the other hand I think it is probably time to recognize
there is more and more bloat in the world.

Thoughts?

Index: share/mk/bsd.own.mk
===================================================================
RCS file: /cvs/src/share/mk/bsd.own.mk,v
retrieving revision 1.194
diff -u -p -r1.194 bsd.own.mk
--- share/mk/bsd.own.mk 28 Jan 2019 17:42:38 -0000 1.194
+++ share/mk/bsd.own.mk 5 Feb 2019 19:20:33 -0000
@@ -137,7 +137,8 @@ STATIC?= -static ${STATICPIE}
 #SYS_INCLUDE= symlinks
 
 # pic relocation flags.
-.if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "sparc64")
+.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \
+    ${MACHINE_ARCH} == "sparc64"
 PICFLAG?=-fPIC
 .else
 PICFLAG?=-fpic

Reply | Threaded
Open this post in threaded view
|

Re: Switch powerpc to big PIC

Philip Guenther-2
On Tue, Feb 5, 2019 at 12:59 PM Mark Kettenis <[hidden email]>
wrote:

> The architecture already has big PIE.  The issue is that clang doesn't
> support secure-plt for small pic.  I haven't entirely figured out
> what's going on here and we probably need some further fixes to clang
> here.  On the other hand I think it is probably time to recognize
> there is more and more bloat in the world.
>
> Thoughts?
>

libexec/ld.so/powerpc/Makefile.inc needs updating to match, no?
---
CFLAGS += -fpic -msoft-float
---


Also, does clang support secure-plt for small pie?  If not, then
lib/csu/Makefile needs updating too:
---
# Override powerpc default of -fPIE
# XXX if this is safe, why not override CFLAGS for alpha and sparc64 too?
# Does it work because the csu bits come first and get the first few GOT
# entries?
.if ${MACHINE_ARCH} == "powerpc"
CFLAGS+=        -fpie
.endif
---


Philip Guenther
Reply | Threaded
Open this post in threaded view
|

Re: Switch powerpc to big PIC

Mark Kettenis
> From: Philip Guenther <[hidden email]>
> Date: Tue, 5 Feb 2019 18:40:09 -0800
>
> On Tue, Feb 5, 2019 at 12:59 PM Mark Kettenis <[hidden email]>
> wrote:
>
>  The architecture already has big PIE.  The issue is that clang doesn't
>  support secure-plt for small pic.  I haven't entirely figured out
>  what's going on here and we probably need some further fixes to clang
>  here.  On the other hand I think it is probably time to recognize
>  there is more and more bloat in the world.
>
>  Thoughts?
>
> libexec/ld.so/powerpc/Makefile.inc needs updating to match, no?
> ---
> CFLAGS += -fpic -msoft-float
> ---

Ultimately, yes.  But my immediate goal is to make it possible to
build libc++abi and libc++.

> Also, does clang support secure-plt for small pie?  If not, then
> lib/csu/Makefile needs updating too:
> ---
> # Override powerpc default of -fPIE
> # XXX if this is safe, why not override CFLAGS for alpha and sparc64 too?
> # Does it work because the csu bits come first and get the first few GOT
> # entries?
> .if ${MACHINE_ARCH} == "powerpc"
> CFLAGS+=        -fpie
> .endif

I still need to investigate this a bit further.  But fi there are no
downsides removing this bit, we probably should at some point.