Skip to content

Commit

Permalink
Makefile: Link final elf with --no-warn-rwx-segments
Browse files Browse the repository at this point in the history
No system loads skiboot as an ELF, so the segment information is not
used.

Avoids these warnings with binutils as of 2.39:

 powerpc64-linux-gnu-ld: warning: skiboot.tmp.elf has a LOAD segment with RWX permissions
 powerpc64-linux-gnu-ld: warning: skiboot.elf has a LOAD segment with RWX permissions

Signed-off-by: Joel Stanley <joel@jms.id.au>
[arbab: Use try-ldflag for builders with pre-2.39 binutils]
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
  • Loading branch information
shenki authored and rarbab committed Aug 9, 2023
1 parent 4183a74 commit 3d634a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile.main
Expand Up @@ -21,6 +21,7 @@ try = $(shell set -e; if ($(1)) >/dev/null 2>&1; \
else echo "$(3)"; fi )

try-cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,$(2))
try-ldflag = $(call try,$(1) $(2) -v,$(2))
test_cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,1,0)

cc-name := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
Expand Down Expand Up @@ -190,6 +191,7 @@ LDFLAGS += -Wl,--oformat,elf64-powerpc
LDFLAGS_FINAL = -m elf64lppc --no-multi-toc -N --build-id=none --whole-archive
LDFLAGS_FINAL += -static -nostdlib -pie -Ttext-segment=$(LD_TEXT) --oformat=elf64-powerpc
LDFLAGS_FINAL += --orphan-handling=warn
LDFLAGS_FINAL += $(call try-ldflag,$(LD),--no-warn-rwx-segments)

LDRFLAGS=-melf64ppc
# Debug stuff
Expand Down

0 comments on commit 3d634a1

Please sign in to comment.