The aarch64 port builds gnumach as a static-PIE so the bootloader
can place it at any 2 MiB-aligned address in RAM (per the Linux
arm64 boot protocol).  That introduces a handful of additional
linker-provided symbols (__rela_start, __rela_end, __bss_start,
__bss_end, _image_end, __text_start) plus a GOT reference
(_GLOBAL_OFFSET_TABLE_) which appear as undefined in gnumach.o
before the final link.

Add these to the undef-check filter so the aarch64 build no longer
fails the gnumach-undef-bad sanity check.  On i386/x86_64 the
kernel doesn't reference any of these symbols, so the additional
filter entries are a no-op there.
---
 Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 6f21e55e..57e80ef4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -175,12 +175,13 @@ noinst_PROGRAMS += \
 # This is the list of routines we use from libgcc.
 libgcc_routines := udivdi3 __udivdi3 __udivmoddi4 __umoddi3 __divdi3 
__divmoddi4 __moddi3 __ffsdi2
 # References generated by ld.
-ld_magic_routines := __rel_iplt_start __rel_iplt_end __rela_iplt_start 
__rela_iplt_end _START etext _edata _end
+ld_magic_routines := __rel_iplt_start __rel_iplt_end __rela_iplt_start 
__rela_iplt_end __rela_start __rela_end \
+       _START etext _edata _end __bss_start __bss_end _image_end __text_start
 gnumach-undef: gnumach.$(OBJEXT)
        $(NM_V) $(NM) -u $< | sed 's/  *U  *//' | sort -u > $@
 MOSTLYCLEANFILES += gnumach-undef
 gnumach-undef-bad: gnumach-undef Makefile
-       $(AM_V_GEN) sed '$(foreach r,$(libgcc_routines) 
$(ld_magic_routines),/^$r$$/d;)' $< > $@
+       $(AM_V_GEN) sed '$(foreach r,$(libgcc_routines) $(ld_magic_routines) 
_GLOBAL_OFFSET_TABLE_,/^$r$$/d;)' $< > $@
 MOSTLYCLEANFILES += gnumach-undef-bad
 libgcc-routines.o: gnumach-undef gnumach-undef-bad
        $(AM_V_at) if test -s gnumach-undef-bad; \
-- 
2.54.0


Reply via email to