NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/57405: clang build has been broken on aarch64 since binutils 2.39 update

>Number:         57405
>Category:       toolchain
>Synopsis:       clang build has been broken on aarch64 since binutils 2.39 update
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 13 10:30:01 +0000 2023
>Originator:     Taylor R Campbell
>Release:        current
The NetLD Foundation
build_install ===> compat       (with: BOOTSTRAP_SUBDIRS=../../../lib)
build_install ===> compat/dirshack
build_install ===> compat/arm/eabi
build_install ===> compat/arm/eabi/../../../lib
dependall-csu ===> compat/arm/eabi/../../../lib
dependall ===> compat/arm/eabi/../../../lib/csu
install-csu ===> compat/arm/eabi/../../../lib
install ===> compat/arm/eabi/../../../lib/csu
dependall-libc ===> compat/arm/eabi/../../../lib
dependall ===> compat/arm/eabi/../../../lib/libc
      build  libc/
/home/riastradh/netbsd/current/src/../obj.arm64-clang/tooldir/aarch64--netbsd/bin/ld: warning: -z relro ignored
aarch64--netbsd-clang: error: linker command failed with exit code 1 (use -v to see invocation)                

This warning appears to be new, arising from this change to ignore the `-z relro' option:

       else if (strcmp (optarg, "nocopyreloc") == 0)
-	link_info.nocopyreloc = TRUE;
+	link_info.nocopyreloc = true;
+if test -n "$COMMONPAGESIZE"; then
+fragment <<EOF
       else if (strcmp (optarg, "relro") == 0)
-	link_info.relro = TRUE;
+	link_info.relro = true;
       else if (strcmp (optarg, "norelro") == 0)
-	link_info.relro = FALSE;
+	link_info.relro = false;
+fragment <<EOF
       else if (strcmp (optarg, "separate-code") == 0)

I'm not sure if relro is expected to work, now or ever, on 32-bit arm, but `-z relro' is passed only if MKRELRO is not `no':

    140 .if ${MKRELRO:Uno} != "no"
    141 LDFLAGS+=	-Wl,-z,relro
    142 .endif

And enables MKRELRO by default on aarch64 and disables it by default on 32-bit arm:

   1137 #
   1138 # RELRO is enabled on i386, amd64, and aarch64 by default
   1139 #
   1140 .if ${MACHINE} == "i386" || \
   1141     ${MACHINE} == "amd64" || \
   1142     ${MACHINE_ARCH:Maarch64*}
   1143 MKRELRO?=	partial
   1144 .else
   1145 MKRELRO?=	no
   1146 .endif

So presumably relro should be disabled during the 32-bit compat library builds.  But it must be enabled if the build fails this way.  Perhaps we need to manually override it somewhere in the makefile magic under src/compat.
./ -c clang -m evbarm64 release
Yes, please!

Home | Main Index | Thread Index | Old Index