configure: Don't warn about lack of PIE on macOS
PATCH 1/1 configure: Don't warn about lack of PIE on macOS
ld64 is making PIE executables for 10.7 and above by default, as documented in ld(1).
--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -2137,6 +2137,8 @@ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" +elif test "$darwin" = "yes"; then + pie="yes" elif test "$pie" = "yes"; then error_exit "PIE not available due to missing toolchain support" else
Signature · 1 line
2.26.1
Cameron Esfahani
[email protected]
"It is the spirit and not the form of law that keeps justice alive."
Earl Warren
Quoted 27 lines · Roman Bolshakov
ld64 is making PIE executables for 10.7 and above by default, as documented in ld(1).
Signed-off-by Roman Bolshakov <[email protected]>---
configure | 2 ++1 file changed, 2 insertions(+)configure +2
-0@@ -2137,6 +2137,8 @@ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" +elif test "$darwin" = "yes"; then + pie="yes"elif test "$pie" = "yes"; then
error_exit"PIE not available due to missing toolchain support"
elseSignature · 1 line
2.26.1
Quoted 13 lines · Roman Bolshakov
ld64 is making PIE executables for 10.7 and above by default, as documented in ld(1).
Signed-off-by Roman Bolshakov <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0
configure elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then · line 2141
Quoted 5 lines
configure +2
-0@@ -2137,6 +2137,8 @@ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" +elif test "$darwin" = "yes"; then + pie="yes"
Hi Roman,
I'm wondering why the elif above doesn't detect the presence of PIE automatically?
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes"
Can this code be tweaked to cover macOS too?
Also CCing Peter Maydell in case he wants to merge this patch directly into qemu.git.
Stefan
Quoted 29 lines · Stefan Hajnoczi
Quoted 13 lines · Roman Bolshakov
ld64 is making PIE executables for 10.7 and above by default, as documented in ld(1).
Signed-off-by Roman Bolshakov <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0configure elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then · line 2141
Quoted 5 lines
configure +2
-0@@ -2137,6 +2137,8 @@ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" +elif test "$darwin" = "yes"; then + pie="yes"Hi Roman,
I'm wondering why the elif above doesn't detect the presence of PIE automatically?elif
compile_prog"-Werror -fPIE -DPIE" "-pie"; then
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes"
Quoted 6 lines
Can this code be tweaked to cover macOS too?
Also CCing Peter Maydell in case he wants to merge this patch directly into qemu.git.
Stefan
Hi Stefan,
It's because clang does not accept -pie/-no-pie directly:
$ cc -Werror -fPIE -DPIE -pie main.c clang: error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
It has to be passed as linker option, i.e. -Wl,-pie or -Wl,-no_pie. pie is also a default behaviour of clang/ld64.
I had a patch to enable proper support of pie/no-pie for macOS but I see little value in it. I don't know where no_pie would be helfpul becuase clang from Apple Developer Tools can't cross-compile option ROMs.
Thanks,
Roman