[Bug 253275] [exp-run] base system PIE default

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Feb 13 22:15:41 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253275

--- Comment #10 from Ed Maste <emaste at freebsd.org> ---
(In reply to michiel from comment #9)
I'm not sure if setting WITH_PIE will work, it may require the changed default
as in the linked review. I tried building www/mathopd on my laptop (with the
PIE default changed) and do see the failure.

You are correct, objects are being compiled w/o -fPIE but linking is attempted
with -pie.

(After a moment) I see what's happening here - www/mathopd/Makefile has:

CFLAGS+=       -DFREEBSD_SENDFILE
MAKE_ARGS=     CFLAGS="${CFLAGS}"

Because option processing (bsd.opts.mk) does not happen in the context of the 
ports Makefile, CFLAGS is just "-O2 -pipe" at this point, and we set
MAKE_ARGS=CFLAGS="-O2 -pipe -DFREEBSD_SENDFILE". This is used as CFLAGS by
bsd.prog.mk later on.

If I make this (hacky) change:

-CFLAGS+=       -DFREEBSD_SENDFILE
+CFLAGS+=       -DFREEBSD_SENDFILE -fPIE

the port builds successfully as PIE. I'm not sure how to do this properly
though.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-ports-bugs mailing list