Page MenuHomeFreeBSD

D28328.id82837.diff
No OneTemporary

D28328.id82837.diff

diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -75,7 +75,6 @@
INIT_ALL_PATTERN \
INIT_ALL_ZERO \
INSTALL_AS_USER \
- PIE \
RETPOLINE \
STALE_STAGED
@@ -85,6 +84,27 @@
STAGING_PROG/STAGING \
STALE_STAGED/STAGING \
+#
+# Default behaviour of some options depends on the architecture. Unfortunately
+# this means that we have to test TARGET_ARCH (the buildworld case) as well
+# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not
+# used at all in bsd.*.mk, but we have to make an exception here if we want
+# to allow defaults for some things like clang to vary by target architecture.
+# Additional, per-target behavior should be rarely added only after much
+# gnashing of teeth and grinding of gears.
+#
+.if defined(TARGET_ARCH)
+__T=${TARGET_ARCH}
+.else
+__T=${MACHINE_ARCH}
+.endif
+
+.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mmips64*} || \\
+ ${__T} == "powerpc64" || ${__T:Mriscv*}
+__DEFAULT_YES_OPTIONS+=PIE
+.else
+__DEFAULT_NO_OPTIONS+=PIE
+.endif
.include <bsd.mkopt.mk>
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -243,21 +243,6 @@
__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
.endfor
-#
-# Default behaviour of some options depends on the architecture. Unfortunately
-# this means that we have to test TARGET_ARCH (the buildworld case) as well
-# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not
-# used at all in bsd.*.mk, but we have to make an exception here if we want
-# to allow defaults for some things like clang to vary by target architecture.
-# Additional, per-target behavior should be rarely added only after much
-# gnashing of teeth and grinding of gears.
-#
-.if defined(TARGET_ARCH)
-__T=${TARGET_ARCH}
-.else
-__T=${MACHINE_ARCH}
-.endif
-
# All supported backends for LLVM_TARGET_XXX
__LLVM_TARGETS= \
aarch64 \

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 7:24 PM (1 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29296506
Default Alt Text
D28328.id82837.diff (1 KB)

Event Timeline