svn commit: r317140 - in stable/11: share/mk sys/boot/efi sys/boot/efi/loader/arch/arm64

Andrew Turner andrew at FreeBSD.org
Wed Apr 19 14:07:36 UTC 2017


Author: andrew
Date: Wed Apr 19 14:07:35 2017
New Revision: 317140
URL: https://svnweb.freebsd.org/changeset/base/317140

Log:
  Fix the arm64 userland building with lld:
  
  MFC 308124:
   On arm64 build the efi loader with -fPIC. Without this clang 3.9 will
   generate relocation in the self relocation code.
  
  MFC 316608:
   Add -fPIC to the standalone build flags on arm64. This is needed as
   loader.efi is position independend, however we were not building it as
   such causing a build failure when building with lld.
  
  MFC 315452:
   Mark the EFI PE header as allocated. While ld.bfd doesn't seem to care
   about not having this flag ld.lld fails to link without it.

Modified:
  stable/11/share/mk/bsd.stand.mk
  stable/11/sys/boot/efi/Makefile.inc
  stable/11/sys/boot/efi/loader/arch/arm64/start.S
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.stand.mk
==============================================================================
--- stable/11/share/mk/bsd.stand.mk	Wed Apr 19 13:24:32 2017	(r317139)
+++ stable/11/share/mk/bsd.stand.mk	Wed Apr 19 14:07:35 2017	(r317140)
@@ -17,7 +17,7 @@ CFLAGS+=	-fPIC -mno-red-zone
 CFLAGS+=	-Os
 .endif
 .if ${MACHINE_CPUARCH} == "aarch64"
-CFLAGS+=	-mgeneral-regs-only
+CFLAGS+=	-fPIC -mgeneral-regs-only
 .endif
 .if ${MACHINE_CPUARCH} == "mips"
 CFLAGS+=	-G0 -fno-pic -mno-abicalls

Modified: stable/11/sys/boot/efi/Makefile.inc
==============================================================================
--- stable/11/sys/boot/efi/Makefile.inc	Wed Apr 19 13:24:32 2017	(r317139)
+++ stable/11/sys/boot/efi/Makefile.inc	Wed Apr 19 14:07:35 2017	(r317140)
@@ -20,6 +20,7 @@ CFLAGS+=	-mno-aes
 
 .if ${MACHINE_CPUARCH} == "aarch64"
 CFLAGS+=	-fshort-wchar
+CFLAGS+=	-fPIC
 .endif
 
 .if ${MACHINE_CPUARCH} == "arm"

Modified: stable/11/sys/boot/efi/loader/arch/arm64/start.S
==============================================================================
--- stable/11/sys/boot/efi/loader/arch/arm64/start.S	Wed Apr 19 13:24:32 2017	(r317139)
+++ stable/11/sys/boot/efi/loader/arch/arm64/start.S	Wed Apr 19 14:07:35 2017	(r317140)
@@ -40,7 +40,7 @@
 #define	IMAGE_SCN_MEM_EXECUTE		0x20000000
 #define	IMAGE_SCN_MEM_READ		0x40000000
 
-	.section .peheader
+	.section .peheader,"a"
 efi_start:
 	/* The MS-DOS Stub, only used to get the offset of the COFF header */
 	.ascii	"MZ"


More information about the svn-src-all mailing list