[llvm-bugs] [Bug 52201] New: clang-13 -static-pie AND -fuse-ld=lld produce unusable a.out

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 18 01:19:31 PDT 2021


            Bug ID: 52201
           Summary: clang-13 -static-pie AND -fuse-ld=lld produce unusable
           Product: clang
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryutaroh at ict.e.titech.ac.jp
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This is originally reported to the downstream Debian BTS as

I am unsure if this issue comes from rcrt1.o (crt1.o for static-pie) and/or
ld-lld, instead of clang-13.
I wanted to choose 13 as "Version", but LLVM BTS does not offer 13 as an
Below is a verbatim copy from Debian #996752

Dear Maintainer,

The following transcript should be self-explanatory.
gcc-11 also procudes unusable a.out with -static-pie as

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)
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
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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211018/3f205ccf/attachment.html>

More information about the llvm-bugs mailing list