From 6f57d919357a43507935a5ea78a66702ac0f3d54 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 30 Jun 2023 12:03:41 +0100 Subject: [build] Use separate code segment if supported by linker Some versions of ld will complain that the automatically created (and unused by our build process) ELF program headers include a "LOAD segment with RWX permissions". Silence this warning by adding "-z separate-code" to the linker options, where supported. For BIOS builds, where the prefix will generally require writable access to its own (tiny) code segment, simply inhibit the warning completely via "--no-warn-rwx-segments". Signed-off-by: Michael Brown --- src/Makefile.housekeeping | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index b32003ea5..4a90b3ca4 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -502,6 +502,13 @@ LDFLAGS += --gc-sections # LDFLAGS += -static +# Use separate code segment if supported by linker +# +ZSC_TEST = $(LD) -z separate-code --version 2>&1 > /dev/null +ZSC_FLAGS := $(shell [ -z "`$(ZSC_TEST)`" ] && \ + $(ECHO) '-z separate-code -z max-page-size=4096') +LDFLAGS += $(ZSC_FLAGS) + # compiler.h is needed for our linking and debugging system # CFLAGS += -include include/compiler.h -- cgit v1.2.3-55-g7522 From daa9e54ab8207ea9bae80db16d664d019d590fb2 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 4 Jul 2023 14:55:53 +0100 Subject: [build] Silence the "creating blib.a" message Signed-off-by: Michael Brown --- src/Makefile.housekeeping | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 4a90b3ca4..3b8ee2587 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -1178,7 +1178,7 @@ BLIB = $(BIN)/blib.a $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS) $(Q)$(RM) $(BLIB) $(QM)$(ECHO) " [AR] $@" - $(Q)$(AR) rD $@ $(sort $(BLIB_OBJS)) + $(Q)$(AR) rcD $@ $(sort $(BLIB_OBJS)) $(Q)$(OBJCOPY) --enable-deterministic-archives \ --prefix-symbols=$(SYMBOL_PREFIX) $@ $(Q)$(RANLIB) -D $@ -- cgit v1.2.3-55-g7522 From 824441069010806b63cc5d110e5acd1f1d1ee858 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 4 Jul 2023 15:12:49 +0100 Subject: [build] Inhibit more linker warnings about an implied executable stack Add .note.GNU-stack section declarations to the autogenerated PCI device ID list objects. Signed-off-by: Michael Brown --- src/Makefile.housekeeping | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 3b8ee2587..d13cb3671 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -1009,6 +1009,7 @@ endif # Device ID tables (using IDs from ROM definition file) # define obj_pci_id_asm + .section ".note.GNU-stack", "", $(ASM_TCHAR)progbits .section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits .globl pci_devlist_$(1) pci_devlist_$(1): -- cgit v1.2.3-55-g7522