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

Bug#1019354: libc6-dev-riscv64-cross: static libc is unusable



Package: libc6-dev-riscv64-cross
Version: 2.34-7cross2
Severity: important

Dear Maintainer,

Even the most trivial C program:
encounters a segmentation crash when linked statically:

# cat << EOF > hello.c
int main(void) { return 0; }
EOF
# riscv64-linux-gnu-gcc -O2 -static hello.c
# qemu-riscv64-static ./a.out

This can be verified both by running the resulting binary under
qemu-riscv64-static or on real RISC-V hardware running the Debian
RISC-V port.

On target hardware, I can get a stack trace in early libc code:

$ gdb ./a.out 
GNU gdb (Debian 12.1-3) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "riscv64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...
(gdb) run
Starting program: /home/remi/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x000000000002ce94 in __ctype_init ()
(gdb) bt
#0  0x000000000002ce94 in __ctype_init ()
#1  0x0000000000023d92 in __libc_early_init ()
Backtrace stopped: frame did not save the PC


There are no such problems with dynamic linking (although in that case
qemu-riscv64-static will obviously refuse to work since it can only
deal with static binaries). There are also no such problems whilst
statically linking Debian libc6 natively on RISC-V: this seems to
affect *only* libc6-dev-riscv64-cross.

This was working fine a few months ago. Not sure when did it break.

Best regards,

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
merged-usr: no
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 5.18.0-4-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fi_FI.UTF-8), LANGUAGE=fr:en_GB:fi
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libc6-dev-riscv64-cross depends on:
ii  libc6-riscv64-cross           2.34-7cross2
ii  linux-libc-dev-riscv64-cross  5.18.16-1cross2

libc6-dev-riscv64-cross recommends no packages.

libc6-dev-riscv64-cross suggests no packages.

-- no debconf information


Reply to: