mold: s390x testsuite failures

I’ve just added s390x builder to OBS: https://build.opensuse.org/package/show/home:marxin:mold/mold

and I see the following failures (with some debugging added):

...
[  805s] Testing bno-symbolic ... + cat
[  805s] + cc -c -fPIC -oout/test/elf/s390x/bno-symbolic/a.o -xc -
[  805s] + cc -B. -shared -fPIC -o out/test/elf/s390x/bno-symbolic/b.so out/test/elf/s390x/bno-symbolic/a.o -Wl,-Bsymbolic -Wl,-Bno-symbolic
[  805s] + cc -c -o out/test/elf/s390x/bno-symbolic/c.o -xc - -fno-PIE
[  805s] + cat
[  805s] + cc -B. -no-pie -o out/test/elf/s390x/bno-symbolic/exe out/test/elf/s390x/bno-symbolic/c.o out/test/elf/s390x/bno-symbolic/b.so
[  805s] + out/test/elf/s390x/bno-symbolic/exe
[  805s] 3 3 0
[  805s] + out/test/elf/s390x/bno-symbolic/exe
[  805s] + grep -q '3 3 1'
[  805s] ++ on_error 35
[  805s] ++ code=1
[  805s] ++ echo 'command failed: 35: grep -q '\''3 3 1'\'''
[  805s] command failed: 35: grep -q '3 3 1'
[  805s] ++ trap - EXIT
[  805s] ++ exit 1
...
[  805s] Testing canonical-plt ... + cat
[  805s] + cc -o out/test/elf/s390x/canonical-plt/a.so -fPIC -shared -xc -
[  805s] + cat
[  805s] + cc -o out/test/elf/s390x/canonical-plt/b.o -c -xc - -fPIC
[  805s] + cat
[  805s] + cc -o out/test/elf/s390x/canonical-plt/c.o -c -xc - -fno-PIC
[  805s] + cc -B. -no-pie -o out/test/elf/s390x/canonical-plt/exe out/test/elf/s390x/canonical-plt/a.so out/test/elf/s390x/canonical-plt/b.o out/test/elf/s390x/canonical-plt/c.o
[  805s] + out/test/elf/s390x/canonical-plt/exe
[  805s] 0 0 0
[  805s] + out/test/elf/s390x/canonical-plt/exe
[  805s] + grep -q '^1 1 1$'
[  805s] ++ on_error 38
[  805s] ++ code=1
[  805s] ++ echo 'command failed: 38: grep -q '\''^1 1 1$'\'''
[  805s] command failed: 38: grep -q '^1 1 1$'
[  805s] ++ trap - EXIT
[  805s] ++ exit 1
...
[  811s] Testing ifunc-static-pie ... + test_cflags -static
[  811s] + echo 'int main() {}'
[  811s] + cc -static -o /dev/null -xc -
[  811s] + '[' s390x = aarch64 ']'
[  811s] + ldd --help
[  811s] + grep -q musl
[  811s] + '[' s390x = i386 ']'
[  811s] + '[' s390x = riscv64 -o s390x = riscv32 ']'
[  811s] + '[' s390x = aarch64 ']'
[  811s] + cat
[  811s] + cc -o out/test/elf/s390x/ifunc-static-pie/a.o -c -xc - -fPIC
[  811s] + cc -o out/test/elf/s390x/ifunc-static-pie/exe1 out/test/elf/s390x/ifunc-static-pie/a.o -static-pie
[  811s] + out/test/elf/s390x/ifunc-static-pie/exe1
[  811s] + cc -B. -o out/test/elf/s390x/ifunc-static-pie/exe2 out/test/elf/s390x/ifunc-static-pie/a.o -static-pie
[  811s] + valgrind out/test/elf/s390x/ifunc-static-pie/exe2
[  811s] ==5836== Memcheck, a memory error detector
[  811s] ==5836== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
[  811s] ==5836== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
[  811s] ==5836== Command: out/test/elf/s390x/ifunc-static-pie/exe2
[  811s] ==5836== 
[  811s] ==5836== Invalid read of size 8
[  811s] ==5836==    at 0x1A13DC: elf_dynamic_do_Rela (do-rel.h:53)
[  811s] ==5836==    by 0x1A13DC: _dl_relocate_static_pie (dl-reloc-static-pie.c:63)
[  811s] ==5836==    by 0x1429E7: (below main) (libc-start.c:295)
[  811s] ==5836==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
[  811s] ==5836== 
[  811s] ==5836== 
[  811s] ==5836== Process terminating with default action of signal 11 (SIGSEGV)
[  811s] ==5836==  Access not within mapped region at address 0x0
[  811s] ==5836==    at 0x1A13DC: elf_dynamic_do_Rela (do-rel.h:53)
[  811s] ==5836==    by 0x1A13DC: _dl_relocate_static_pie (dl-reloc-static-pie.c:63)
[  811s] ==5836==    by 0x1429E7: (below main) (libc-start.c:295)
[  811s] ==5836==  If you believe this happened as a result of a stack
[  811s] ==5836==  overflow in your program's main thread (unlikely but
[  811s] ==5836==  possible), you can try to increase the size of the
[  811s] ==5836==  main thread stack using the --main-stacksize= flag.
[  811s] ==5836==  The main thread stack size used in this run was 8388608.
[  811s] ==5836== 
[  811s] ==5836== HEAP SUMMARY:
[  811s] ==5836==     in use at exit: 0 bytes in 0 blocks
[  811s] ==5836==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
[  811s] ==5836== 
[  811s] ==5836== All heap blocks were freed -- no leaks are possible
[  811s] ==5836== 
[  811s] ==5836== For lists of detected and suppressed errors, rerun with: -s
[  811s] ==5836== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[  811s] ./test/elf/ifunc-static-pie.sh: line 44:  5836 Segmentation fault      valgrind $t/exe2
[  811s] ++ on_error 44
[  811s] ++ code=139
[  811s] ++ echo 'command failed: 44: valgrind $t/exe2'
[  811s] command failed: 44: valgrind $t/exe2
[  811s] ++ trap - EXIT
...
[  816s] Testing static-pie ... + test_cflags -static
[  816s] + echo 'int main() {}'
[  816s] + cc -static -o /dev/null -xc -
[  816s] + '[' s390x = i386 ']'
[  816s] + '[' s390x = aarch64 ']'
[  816s] + cat
[  816s] + cc -o out/test/elf/s390x/static-pie/a.o -c -xc - -fPIE
[  816s] + cc -o out/test/elf/s390x/static-pie/exe1 out/test/elf/s390x/static-pie/a.o -static-pie
[  816s] + out/test/elf/s390x/static-pie/exe1
[  816s] + cc -B. -o out/test/elf/s390x/static-pie/exe2 out/test/elf/s390x/static-pie/a.o -static-pie
[  816s] + valgrind out/test/elf/s390x/static-pie/exe2
[  816s] ==8005== Memcheck, a memory error detector
[  816s] ==8005== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
[  816s] ==8005== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
[  816s] ==8005== Command: out/test/elf/s390x/static-pie/exe2
[  816s] ==8005== 
[  816s] ==8005== Invalid read of size 8
[  816s] ==8005==    at 0x1A12FC: elf_dynamic_do_Rela (do-rel.h:53)
[  816s] ==8005==    by 0x1A12FC: _dl_relocate_static_pie (dl-reloc-static-pie.c:63)
[  816s] ==8005==    by 0x142907: (below main) (libc-start.c:295)
[  816s] ==8005==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
[  816s] ==8005== 
[  816s] ==8005== 
[  816s] ==8005== Process terminating with default action of signal 11 (SIGSEGV)
[  816s] ==8005==  Access not within mapped region at address 0x0
[  816s] ==8005==    at 0x1A12FC: elf_dynamic_do_Rela (do-rel.h:53)
[  816s] ==8005==    by 0x1A12FC: _dl_relocate_static_pie (dl-reloc-static-pie.c:63)
[  816s] ==8005==    by 0x142907: (below main) (libc-start.c:295)
[  816s] ==8005==  If you believe this happened as a result of a stack
[  816s] ==8005==  overflow in your program's main thread (unlikely but
[  816s] ==8005==  possible), you can try to increase the size of the
[  816s] ==8005==  main thread stack using the --main-stacksize= flag.
[  816s] ==8005==  The main thread stack size used in this run was 8388608.
[  816s] ==8005== 
[  816s] ==8005== HEAP SUMMARY:
[  816s] ==8005==     in use at exit: 0 bytes in 0 blocks
[  816s] ==8005==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
[  816s] ==8005== 
[  816s] ==8005== All heap blocks were freed -- no leaks are possible
[  816s] ==8005== 
[  816s] ==8005== For lists of detected and suppressed errors, rerun with: -s
[  816s] ==8005== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[  816s] ./test/elf/static-pie.sh: line 25:  8005 Segmentation fault      valgrind $QEMU $t/exe2
[  816s] ++ on_error 25
[  816s] ++ code=139
[  816s] ++ echo 'command failed: 25: valgrind $QEMU $t/exe2'
[  816s] command failed: 25: valgrind $QEMU $t/exe2
[  816s] ++ trap - EXIT
[  816s] ++ exit 139

Please let me know which files should I provide.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like it’s another GCC bug, which unconditionally appends @PLT to a symbol if it is a function. I’ll update the bug report that I opened to GAS.

$ echo 'void foo(); void *bar() { return foo; }' | gcc-12 -S -o- -xc -
        .file   "<stdin>"
        .machinemode zarch
        .machine "z196"
.text
        .align  8
.globl bar
        .type   bar, @function
bar:
.LFB0:
        .cfi_startproc
        ldgr    %f0,%r11
        .cfi_register 11, 16
        lgr     %r11,%r15
        .cfi_def_cfa_register 11
        larl    %r1,foo@PLT
        lgr     %r2,%r1
        lgdr    %r11,%f0
        .cfi_restore 11
        .cfi_def_cfa_register 15
        br      %r14
        .cfi_endproc
.LFE0:
        .size   bar, .-bar
        .ident  "GCC: (SUSE Linux) 12.1.1 20220812 [revision 6b7d570a5001bb79e34c0d1626a8c7f55386dac7]"
        .section        .note.GNU-stack,"",@progbits