rui314 / mold

Mold: A Modern Linker 🦠
MIT License
13.95k stars 459 forks source link

Test #119: x86_64-gdb-index-dwarf5 fails #1122

Closed ms178 closed 10 months ago

ms178 commented 10 months ago

With c7129916eeb6df2b57d88415a16a28c09ec01b1a and the CachyOS distro compiler (GCC 13.2.1 20230801), I see a test failure that I didn't get before on an earlier recent mold-git revision (0eea8f401509b882d41264990b53cdf75416f515):

119/333 Test #119: x86_64-gdb-index-dwarf5 .................***Failed    0.25 sec
++ dirname /tmp/makepkg/mold-git/src/mold/test/elf/gdb-index-dwarf5.sh
+ . /tmp/makepkg/mold-git/src/mold/test/elf/common.inc
++ export LC_ALL=C
++ LC_ALL=C
++++ uname -m
+++ canonical_name x86_64
+++ case $1 in
+++ echo x86_64
++ HOST=x86_64
++ '[' '' = '' ']'
++ MACHINE=x86_64
++ TESTDIR=out/test/elf/x86_64
++ CC=cc
++ CXX=c++
++ GCC=gcc
++ GXX=g++
++ OBJDUMP=objdump
++ OBJCOPY=objcopy
++ STRIP=strip
++ QEMU=
++ '[' x86_64 = x86_64 -o x86_64 = i386 -o x86_64 = arm ']'
++ tlsdesc_opt=-mtls-dialect=gnu2
++ trap 'on_error $LINENO' ERR
++ trap on_exit EXIT
+++ basename /tmp/makepkg/mold-git/src/mold/test/elf/gdb-index-dwarf5.sh .sh
++ testname=gdb-index-dwarf5
++ echo -n 'Testing gdb-index-dwarf5 ... '
Testing gdb-index-dwarf5 ... ++ t=out/test/elf/x86_64/gdb-index-dwarf5
++ mkdir -p out/test/elf/x86_64/gdb-index-dwarf5
+ '[' x86_64 = x86_64 ']'
+ '[' x86_64 = riscv64 -o x86_64 = riscv32 -o x86_64 = sparc64 ']'
+ command -v gdb
+ test_cflags -gdwarf-5 -g
+ echo 'int main() {}'
+ cc -gdwarf-5 -g -o /dev/null -xc -
+ cat
+ cat
+ cat
+ cat
+ cc -c -o out/test/elf/x86_64/gdb-index-dwarf5/a.o out/test/elf/x86_64/gdb-index-dwarf5/a.c -fPIC -g -ggnu-pubnames -gdwarf-5 -ffunction-sections
+ cc -c -o out/test/elf/x86_64/gdb-index-dwarf5/b.o out/test/elf/x86_64/gdb-index-dwarf5/b.c -fPIC -g -ggnu-pubnames -gdwarf-4 -ffunction-sections
+ cc -c -o out/test/elf/x86_64/gdb-index-dwarf5/c.o out/test/elf/x86_64/gdb-index-dwarf5/c.c -fPIC -g -ggnu-pubnames -gdwarf-5
+ cc -c -o out/test/elf/x86_64/gdb-index-dwarf5/d.o out/test/elf/x86_64/gdb-index-dwarf5/d.c -fPIC -g -ggnu-pubnames -gdwarf-5 -ffunction-sections
+ cc -B. -shared -o out/test/elf/x86_64/gdb-index-dwarf5/e.so out/test/elf/x86_64/gdb-index-dwarf5/a.o out/test/elf/x86_64/gdb-index-dwarf5/b.o out/test/elf/x86_64/gdb-index-dwarf5/c.o out/test/elf/x86_64/gdb-index-dwarf5/d.o -Wl,--gdb-index
+ readelf -WS out/test/elf/x86_64/gdb-index-dwarf5/e.so
+ grep -Fq .gdb_index
+ cat
+ cc -c -o out/test/elf/x86_64/gdb-index-dwarf5/f.o -fPIC -g -ggnu-pubnames -gdwarf-5 -xc - -gz
+ cc -B. -o out/test/elf/x86_64/gdb-index-dwarf5/exe out/test/elf/x86_64/gdb-index-dwarf5/e.so out/test/elf/x86_64/gdb-index-dwarf5/f.o -Wl,--gdb-index
+ readelf -WS out/test/elf/x86_64/gdb-index-dwarf5/exe
+ grep -Fq .gdb_index
+ out/test/elf/x86_64/gdb-index-dwarf5/exe
+ grep -q 'Hello world'
+ DEBUGINFOD_URLS=
+ gdb out/test/elf/x86_64/gdb-index-dwarf5/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' -ex c -ex bt -ex quit
+ grep -q 'fn8 () at .*/d.c:6' out/test/elf/x86_64/gdb-index-dwarf5/log
+ grep -q 'fn7 () at .*/d.c:10' out/test/elf/x86_64/gdb-index-dwarf5/log
+ grep -q 'fn6 () at .*/c.c:4' out/test/elf/x86_64/gdb-index-dwarf5/log
++ on_error 87
++ code=1
++ echo 'command failed: 87: grep -q '\''fn6 () at .*/c.c:4'\'' $t/log'
command failed: 87: grep -q 'fn6 () at .*/c.c:4' $t/log
++ trap - EXIT
++ exit 1

Flags:

CFLAGS="-O3 -march=native -mtune=native -maes -mbmi2 -mpclmul -fno-semantic-interposition -falign-functions=32 -fipa-pta -flive-range-shrinkage -fno-math-errno -fno-trapping-math -mtls-dialect=gnu2 -feliminate-unused-debug-types -floop-nest-optimize -fgraphite-identity -fcf-protection=none -pipe -flto=auto -fdevirtualize-at-ltrans -mharden-sls=none -funroll-loops -malign-data=cacheline -fomit-frame-pointer -mprefer-vector-width=256 -fivopts -fmodulo-sched -fdata-sections -ffunction-sections -Wl,-zmax-page-size=0x200000"
CXXFLAGS="$CFLAGS -Wp,-U_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O3,--as-needed,-Bsymbolic-functions,--sort-common,-flto=auto -Wl,--gc-sections -march=native -mtune=native -maes -mbmi2 -mpclmul -Wl,-zmax-page-size=0x200000"
CCLDFLAGS="$LDFLAGS"
CXXLDFLAGS="$LDFLAGS"
FFLAGS="$CFLAGS"
FCFLAGS="$CFLAGS"
ASFLAGS="-D__AVX__=1 -D__AVX2__=1 -msse2avx -D__FMA__=1"
LTOFLAGS="-flto=auto"

Here is the used PKGBUILD for reference: PKGBUILD.txt

ptr1337 commented 10 months ago

Can reproduce locally CI is also failing: https://github.com/rui314/mold/actions/runs/6391489275/job/17346876069

rui314 commented 10 months ago

I can confirm the issue. It is extremely odd that that change caused this error, but for now, I'll revert it to fix CI.