Bug#904446: clang-6.0: fails to link a sanitized binary with gold

Sylvain Joubert joubert.sy at gmail.com
Tue Jul 24 13:33:07 BST 2018


Package: clang-6.0
Version: 1:6.0.1-2
Severity: important

Dear Maintainer,

First, I'm not really sure clang is at fault here since this issue requires a
specific combination involving the clang++ compiler, the gold linker and the
sanitizers options.
Basically, with a specific combination of these tools the link step produces a
warning, which may result in a link error if '-Wl,--fatal-warnings' is used.

  $ cat main.cpp
  int main(){ return 0; }

  $ /usr/bin/clang++-6.0 -o main.o -c main.cpp -fsanitize=address

  $ /usr/bin/clang++-6.0 -o main main.o -fsanitize=address -fuse-ld=gold
  /usr/bin/ld.gold: warning: discarding version information for
__libc_stack_end at GLIBC_2.2.5, defined in unused shared library
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 (linked with --as-needed)

* Using clang-6.0 (as a C compiler) or clang++-7 (1:7~svn331965-1) does not
solve the issue
* Using g++-8 instead of clang++-6.0 works fine
* Using '-fuse-ld=bfd', '-fuse-ld=lld' or no flags (bfd default) works fine
* Using another ('undefined', 'thread' or 'memory') sanitizer is also broken
while no sanitizers works fine

Sylvain



-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (800, 'stable-updates'), (800, 'stable'), (700, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.16.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE= (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages clang-6.0 depends on:
ii  binutils                 2.31.1-1
ii  libc6                    2.27-5
ii  libc6-dev                2.27-5
ii  libclang-common-6.0-dev  1:6.0.1-2
ii  libclang1-6.0            1:6.0.1-2
ii  libgcc-7-dev             7.3.0-25
ii  libgcc1                  1:8.1.0-10
ii  libjsoncpp1              1.7.4-3
ii  libllvm6.0               1:6.0.1-2
ii  libobjc-7-dev            7.3.0-25
ii  libstdc++-7-dev          7.3.0-25
ii  libstdc++6               8.1.0-10

Versions of packages clang-6.0 recommends:
ii  libomp-dev    6.0.1-1
ii  llvm-6.0-dev  1:6.0.1-2
ii  python        2.7.15-3

Versions of packages clang-6.0 suggests:
pn  clang-6.0-doc  <none>
pn  gnustep        <none>
pn  gnustep-devel  <none>

-- no debconf information



More information about the Pkg-llvm-team mailing list