Re: Switch powerpc to big PIC

2019-04-17 Thread Mark Kettenis
> Date: Tue, 5 Feb 2019 21:57:31 +0100 (CET)
> From: 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?

I'd like to move ahead with this now that the tree is unlocked.

ok?

> 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 -  1.194
> +++ share/mk/bsd.own.mk   5 Feb 2019 19:20:33 -
> @@ -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
> 
> 



Re: Switch powerpc to big PIC

2019-02-07 Thread Mark Kettenis
> From: Philip Guenther 
> Date: Tue, 5 Feb 2019 18:40:09 -0800
> 
> On Tue, Feb 5, 2019 at 12:59 PM Mark Kettenis 
> 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.



Re: Switch powerpc to big PIC

2019-02-05 Thread Philip Guenther
On Tue, Feb 5, 2019 at 12:59 PM Mark Kettenis 
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


Switch powerpc to big PIC

2019-02-05 Thread 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 -  1.194
+++ share/mk/bsd.own.mk 5 Feb 2019 19:20:33 -
@@ -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