On Sat, Apr 13, 2024 at 01:19:05PM +0100, Patrick Welche wrote: > Building xsrc on -current/amd64 with > > HAVE_MESA_VER=21 > HAVE_GCC=12 > > fails for me with > > /usr/xsrc/external/mit/MesaLib/dist/src/amd/common/ac_rtld.c:658:20: error: > 'STN_UNDEF' undeclared (first use in this function); did you mean 'SHN_UNDEF'? > 658 | if (r_sym == STN_UNDEF) { > | ^~~~~~~~~ > | SHN_UNDEF > /usr/xsrc/external/mit/MesaLib/dist/src/amd/common/ac_rtld.c:658:20: note: > each undeclared identifier is reported only once for each function it appears > in > > Non standard build options I know, but it had worked, and I had a complete > build on 27 March... > > STN_UNDEF / SHN_UNDEF appear to be from LLVM? (and this bit of build I think > is gallium == llvmpipe?)
Really confused: STN_UNDEF should be found via libelf.h -> sys/exec_elf.h cd /usr/src/external/mit make -j24 dependall make -j24 install works without complaint, and then cd /usr/src sh build.sh -u -x -j24 -E build fails with the above *** Failed target: ac_rtld.pico If I run the lengthy output of *** Failed commands: ${_MKTARGET_COMPILE} => @echo '# ' "compile " gallium/ac_rtld.pico ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} I can reproduce the problem. If I use "gcc -E", I see ---------- typedef struct { uint32_t gh_nbuckets; uint32_t gh_symndx; uint32_t gh_maskwords; uint32_t gh_shift2; } Elf_GNU_Hash_Header; # 35 "/usr/include/elfdefinitions.h" 2 3 4 # 41 "/usr/include/libelf.h" 2 3 4 typedef struct _Elf Elf; typedef struct _Elf_Scn Elf_Scn; --------- c.f. libelf.h --------- #ifdef BUILTIN_ELF_HEADERS # include <sys/types.h> # include <stdint.h> # include "elfdefinitions.h" #elif HAVE_NBTOOL_CONFIG_H # include <nbinclude/sys/exec_elf.h> #elif defined(__NetBSD__) # include <sys/types.h> # include <sys/exec_elf.h> #elif defined(__FreeBSD__) # include <sys/types.h> # include <sys/elf32.h> # include <sys/elf64.h> #else #error "No valid elf headers" #endif /* Library private data structures */ typedef struct _Elf Elf; typedef struct _Elf_Scn Elf_Scn; --------- My current suspicion is that "elfdefinitions.h" is being used rather than sys/exec_elf.h, the latter is the one which defines STN_UNDEF: $ grep _UNDEF elfdefinitions.h exec_elf.h elfdefinitions.h:#define SHN_UNDEF 0 exec_elf.h:#define ELF_SYM_UNDEFINED 0 exec_elf.h:#define STN_UNDEF 0 /* undefined index */ exec_elf.h:#define SHN_UNDEF 0 /* Undefined section */ but I don't see "BUILTIN_ELF_HEADERS" in the failing command line, and why would "make dependall" behave differently? My guess is that adding STN_UNDEF to elfdefintions.h will patch over this, but I don't see why build.sh would behave differently. Possibly related to Author: riastradh <riastr...@netbsd.org> Date: Mon Apr 1 18:33:22 2024 +0000 elftoolchain: Be consistent about which ELF header files we use. which would match my notion of it working on 27 March? Cheers, Patrick