NetBSD-Bugs archive

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

toolchain/58437: Building tools/gcc on a Solaris 11.4 host after GCC has been switched to GCC 12 fails



>Number:         58437
>Category:       toolchain
>Synopsis:       Building tools/gcc on a Solaris 11.4 host after GCC has been switched to GCC 12 fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 17 20:25:00 +0000 2024
>Originator:     Palle Lyckegaard
>Release:        current
>Organization:
NetBSD
>Environment:
SunOS s11-sparc.cfarm 5.11 11.4.71.170.2 sun4v sparc sun4v logical-domain

>Description:
After the switch to GCC 12 building tools/gcc on a Solaris 11.4 host system has started to fail.

build.sh tools fails with:

...
/usr/bin/bash ./libtool --tag=CC --tag=disable-static  --mode=link /usr/bin/gcc -Wall  -O -Wc,-static-libgcc  -module -avoid-version -bindir /home/palle/netbsd/build/sparc64/tooldir/libexec/gcc/sparc64--netbsd/12.4.0 -export-symbols-regex onload    -o liblto_plugin.la -rpath /home/palle/netbsd/build/sparc64/tooldir/libexec/gcc/sparc64--netbsd/12.4.0 lto-plugin.lo  -Wc,../libiberty/pic/libiberty.a 
libtool: link: nm  .libs/lto-plugin.o   |  | /usr/bin/gsed 's/.* //' | sort | uniq > .libs/liblto_plugin.exp
./libtool: eval: line 1116: syntax error near unexpected token `|'
./libtool: eval: line 1116: `nm  .libs/lto-plugin.o   |  | /usr/bin/gsed 's/.* //' | sort | uniq > .libs/liblto_plugin.exp'
nbgmake[2]: *** [liblto_plugin.la] Error 2
nbgmake[2]: Leaving directory `/home/palle/netbsd/build/sparc64/objdir/tools/gcc/build/lto-plugin'
nbgmake[1]: *** [all] Error 2
nbgmake[1]: Leaving directory `/home/palle/netbsd/build/sparc64/objdir/tools/gcc/build/lto-plugin'
:
...


Investigating tools/gcc/lto-plugin configure:

...
configure:7527: checking command to parse nm output from /usr/bin/gcc object
configure:7645: /usr/bin/gcc -c -O   -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0  -DTARGET_SYSTEM_ROOT_RELOCATABLE conftest.c >&5
configure:7648: $? = 0
configure:7652: nm conftest.o \| sed -n -e 's/^.*[ ]\([BDRT][BDRT]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm
configure:7655: $? = 0
cannot run sed -n -e 's/^.*[     ]\([BDRT][BDRT]*\)[     ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'
configure:7645: /usr/bin/gcc -c -O   -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0  -DTARGET_SYSTEM_ROOT_RELOCATABLE conftest.c >&5
configure:7648: $? = 0
configure:7652: nm conftest.o \| sed -n -e 's/^.*[ ]\([BDRT][BDRT]*\)[ ][ ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' \> conftest.nm
configure:7655: $? = 0
cannot run sed -n -e 's/^.*[     ]\([BDRT][BDRT]*\)[     ][      ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p'
configure:7747: result: failed
configure:7957: /usr/bin/gcc -c -O   -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0  -DTARGET_SYSTEM_ROOT_RELOCATABLE conftest.c >&5
configure:7960: $? = 0
...

Solaris nm is not usable here as show below:


conftest.c

#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}


nm contest.o output on a system with GNU nm:

                 U
0000000000000008 T main
0000000000000000 T nm_test_func
0000000000000000 B nm_test_var


nm outout on a Solaris 11.4 system:

conftest.o:

[Index]   Value                Size                Type  Bind  Other Shndx   Name

[5]     |                   0|                   0|SECT |LOCL |0    |5      |
[2]     |                   0|                   0|SECT |LOCL |0    |1      |
[3]     |                   0|                   0|SECT |LOCL |0    |3      |
[4]     |                   0|                   0|SECT |LOCL |0    |4      |
[8]     |                   2|                   0|REGI |GLOB |0    |UNDEF  |
[7]     |                   8|                  28|FUNC |GLOB |0    |1      |main
[6]     |                   0|                   8|FUNC |GLOB |0    |1      |nm_test_func
[9]     |                   0|                   1|OBJT |GLOB |0    |4      |nm_test_var
[1]     |                   0|                   0|FILE |LOCL |0    |ABS    |conftest.c



So the output from the GNU nm and Solaris nm commands obviously differs, so the configure script fails.







>How-To-Repeat:
Issue a build.sh tools command on a Solaris 11.4 system.

>Fix:
Simple patch to tools/gcc/Makefile so the tool/nm version is used as NM.

Verified on a Solaris 11.4 host and GNU host (Ubuntu Linux) - assumes no issues on a NetBSD host.


diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
index 8b9797992d7b..223d84a047c4 100644
--- a/tools/gcc/Makefile
+++ b/tools/gcc/Makefile
@@ -95,7 +95,7 @@ GCC_CPPFLAGS+=        -DNB_FIX_VAX_BACKEND
 MAKE_ARGS=     MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
                LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
                EXTRA_PARTS= CPPFLAGS=${GCC_CPPFLAGS:Q} \
-               AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
+               AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q} NM=${NM:Q}
 
 CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes \
                gcc_cv_as_sparc_gotdata_op=no



Home | Main Index | Thread Index | Old Index