Permalink
Browse files

HBSD: Enable PIEified base for ARM64.

FreeBSD doesn't support Position-Independent Code in the loader stages
on ARM64 (yet?). Move a couple things around and disable PICification
and PIEification of the loader bits on ARM64. I'd assume that the same
thing would need to happen for ARM, but I'd like that architecture to
die the same death I wish upon i386.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
  • Loading branch information...
lattera committed Apr 18, 2016
1 parent 4b99d47 commit eba704182762cacb6add82ee6b9066d535add1a6
View
@@ -9,6 +9,7 @@
PACKAGE=lib${LIB}
MK_PROFILE= no
MK_SSP= no
+NO_PIC=
.include <src.opts.mk>
@@ -17,7 +18,6 @@ LIBSTAND_CPUARCH?=${MACHINE_CPUARCH}
LIBC_SRC= ${LIBSTAND_SRC}/../libc
LIB= stand
-NO_PIC=
INCS?= stand.h
MAN?= libstand.3
View
@@ -256,7 +256,7 @@ BROKEN_OPTIONS+=LLDB
BROKEN_OPTIONS+=LIBSOFT
.endif
-.if ${__T} == "amd64" || ${__T} == "i386"
+.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "aarch64"
__DEFAULT_YES_OPTIONS+=PIE
.else
__DEFAULT_NO_OPTIONS+=PIE
@@ -11,6 +11,7 @@ SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
.elif ${MACHINE_CPUARCH} == "aarch64"
SRCS+= load_elf64.c reloc_elf64.c
+NOPIE= 1
.elif ${MACHINE_CPUARCH} == "arm"
SRCS+= load_elf32.c reloc_elf32.c
.elif ${MACHINE_CPUARCH} == "powerpc"
@@ -2,6 +2,10 @@
MAN=
+.if ${MACHINE_CPUARCH} == "aarch64"
+NOPIE= 1
+.endif
+
.include <src.opts.mk>
MK_SSP= no
@@ -9,6 +9,7 @@ SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
.if ${MACHINE_CPUARCH} == "aarch64"
CFLAGS+= -msoft-float -mgeneral-regs-only
+NOPIE= 1
.endif
.if ${MACHINE_ARCH} == "amd64"
CFLAGS+= -fPIC -mno-red-zone
@@ -2,6 +2,10 @@
MAN=
+.if ${MACHINE_CPUARCH} == "aarch64"
+NOPIE= 1
+.endif
+
.include <src.opts.mk>
MK_SSP= no
@@ -22,3 +22,5 @@ loader.help: help.common
FILES+= loader.rc
.endif
+
+NOPIE= 1
View
@@ -26,5 +26,9 @@ CFLAGS+= -m32
CFLAGS+= -Wformat -Wall
+.if ${MACHINE_CPUARCH} == "aarch64"
+NOPIE= 1
+.endif
+
.include <bsd.stand.mk>
.include <bsd.lib.mk>
View
@@ -3,6 +3,10 @@
FICLDIR?= ${.CURDIR}
+.if ${MACHINE_CPUARCH} == "aarch64"
+NOPIE= 1
+.endif
+
.if defined(FICL32)
.PATH: ${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/}
.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
View
@@ -51,6 +51,9 @@ CFLAGS+= -m32
.if ${MACHINE_CPUARCH} == "mips"
CFLAGS+= -mno-abicalls
.endif
+.if ${MACHINE_CPUARCH} == "aarch64"
+NOPIE= 1
+.endif
.include "usbcore.mk"

0 comments on commit eba7041

Please sign in to comment.