Re: Use -z notext -z norelro for armv7 efiboot

2018-06-22 Thread Philip Guenther
On Fri, Jun 22, 2018 at 3:04 AM Mark Kettenis 
wrote:

> Creating relocations inside .text is inherent to the way we wrap an
> ELF shared object inside a PE executable.  But without -z notext
> lld(1) complains about this.  Also pass -z norelro to suppress the
> creation of a separate rodata segment that makes lld(1) complain about
> relocations against a read-only section.  This makes it possible to
> build efiboot with lld(1) on armv7.
>
> ok?
>

ok guenther@


Use -z notext -z norelro for armv7 efiboot

2018-06-22 Thread Mark Kettenis
Creating relocations inside .text is inherent to the way we wrap an
ELF shared object inside a PE executable.  But without -z notext
lld(1) complains about this.  Also pass -z norelro to suppress the
creation of a separate rodata segment that makes lld(1) complain about
relocations against a read-only section.  This makes it possible to
build efiboot with lld(1) on armv7.

ok?


Index: arch/armv7/stand/efiboot/Makefile
===
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- arch/armv7/stand/efiboot/Makefile   11 May 2018 11:58:59 -  1.10
+++ arch/armv7/stand/efiboot/Makefile   22 Jun 2018 09:56:53 -
@@ -17,7 +17,8 @@ EFIDIR=   ${S}/stand/efi
 OBJCOPY?=  objcopy
 OBJDUMP?=  objdump
 
-LDFLAGS+=-nostdlib -T ${.CURDIR}/ldscript.arm -Bsymbolic -shared
+LDFLAGS+=  -nostdlib -T ${.CURDIR}/ldscript.arm -Bsymbolic -shared
+LDFLAGS+=  -z notext -z norelro
 
 .PATH: ${S}/stand/boot
 SRCS+= boot.c cmd.c vars.c