aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/kmod.mk
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2015-10-08 17:42:08 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2015-10-08 17:42:08 +0000
commit8598392cd1689f85847eff08ff3b9feeadcb6114 (patch)
tree7ec5d2391d1ce937db12fe46445cab4cc4e60e82 /sys/conf/kmod.mk
parentd0177d09592d1b6c7d9aa5f38317eac30154a09d (diff)
downloadsrc-8598392cd1689f85847eff08ff3b9feeadcb6114.tar.gz
src-8598392cd1689f85847eff08ff3b9feeadcb6114.zip
Build changes that allow the modules on arm64.
- Move the required kernel compiler flags from Makefile.arm64 to kern.mk. - Build arm64 modules as PIC; non-PIC relocations in .o for shared object output cannot be handled. - Do not try to install aarch64 symlink. - A hack for arm64 to avoid ld -r stage. See the comment for the explanation. Some functionality is lost, like ctf handling, but hopefully will be restored after newer linker is available. Reviewed by: andrew, emaste Tested by: andrew (on real hardware) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3796
Notes
Notes: svn path=/head/; revision=289039
Diffstat (limited to 'sys/conf/kmod.mk')
-rw-r--r--sys/conf/kmod.mk16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 47bc593b0018..06e4cfcdc1f4 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -113,6 +113,10 @@ CFLAGS+= ${DEBUG_FLAGS}
CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
.endif
+.if ${MACHINE_CPUARCH} == "aarch64"
+CFLAGS+= -fPIC
+.endif
+
# Temporary workaround for PR 196407, which contains the fascinating details.
# Don't allow clang to use fpu instructions or registers in kernel modules.
.if ${MACHINE_CPUARCH} == arm
@@ -182,7 +186,17 @@ ${PROG}.debug: ${FULLPROG}
.if ${__KLD_SHARED} == yes
${FULLPROG}: ${KMOD}.kld
+.if ${MACHINE_CPUARCH} != "aarch64"
${LD} -Bshareable ${_LDFLAGS} -o ${.TARGET} ${KMOD}.kld
+.else
+#XXXKIB Relocatable linking in aarch64 ld from binutils 2.25.1 does
+# not work. The linker corrupts the references to the external
+# symbols which are defined by other object in the linking set
+# and should therefore loose the GOT entry. The problem seems
+# to be fixed in the binutils-gdb git HEAD as of 2015-10-04. Hack
+# below allows to get partially functioning modules for now.
+ ${LD} -Bshareable ${_LDFLAGS} -o ${.TARGET} ${OBJS}
+.endif
.if !defined(DEBUG_FLAGS)
${OBJCOPY} --strip-debug ${.TARGET}
.endif
@@ -220,7 +234,7 @@ ${FULLPROG}: ${OBJS}
.endif
_ILINKS=machine
-.if ${MACHINE} != ${MACHINE_CPUARCH}
+.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
_ILINKS+=${MACHINE_CPUARCH}
.endif
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"