Bug#996752: clang-13: -static-pie AND -fuse-ld=lld produce unusable a.out

Ryutaroh Matsumoto ryutaroh at ict.e.titech.ac.jp
Mon Oct 18 08:39:21 BST 2021


Package: clang-13
Version: 1:13.0.0-5
Severity: normal
X-Debbugs-Cc: 996659 at bugs.debian.org

Dear Maintainer,

The following transcript should be self-explanatory.
gcc-11 also procudes unusable a.out with -static-pie as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996659

This issue could be a duplicate of #996659
but I am unsure.
This could also be an issue of lld-13 instead of clang-13...

$ clang-13 -g -static-pie -fPIE hello.c
$ ./a.out 
hello world!
$ clang-13 -g -fuse-ld=lld -static-pie -fPIE hello.c 
$ ./a.out 
Segmentation fault
$ ldd a.out 
	statically linked
$ gdb a.out
GNU gdb (Debian 10.1-2) 10.1.90.20210103-git
Reading symbols from a.out...
(gdb) run
Starting program: /home/ryutaroh/clang-test/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x0000fffff7fd8210 in _dl_relocate_static_pie ()
(gdb) info stack
#0  0x0000fffff7fd8210 in _dl_relocate_static_pie ()
#1  0x0000fffff7f8663c in __libc_start_main ()
#2  0x0000fffff7f864b8 in _start ()
(gdb) info local
No symbol table info available.
(gdb) quit
A debugging session is active.

	Inferior 1 [process 530049] will be killed.

Quit anyway? (y or n) y

Best regards, Ryutaroh Matsumoto

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: arm64 (aarch64)

Kernel: Linux 5.14.12-clang13 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_CRAP
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages clang-13 depends on:
ii  binutils                2.37-7
ii  libc6                   2.32-4
ii  libc6-dev               2.32-4
ii  libclang-common-13-dev  1:13.0.0-5
ii  libclang-cpp13          1:13.0.0-5
ii  libclang1-13            1:13.0.0-5
ii  libgcc-11-dev           11.2.0-9
ii  libgcc-s1               11.2.0-9
ii  libllvm13               1:13.0.0-5
ii  libobjc-11-dev          11.2.0-9
ii  libstdc++-11-dev        11.2.0-9
ii  libstdc++6              11.2.0-9

Versions of packages clang-13 recommends:
ii  llvm-13-dev  1:13.0.0-5
ii  python3      3.9.2-3

Versions of packages clang-13 suggests:
pn  clang-13-doc  <none>

-- no debconf information



More information about the Pkg-llvm-team mailing list