Bug#916975: llvm*-dbgsym not built - no build IDs

Rebecca N. Palmer rebecca_palmer at zoho.com
Thu Dec 20 22:15:56 GMT 2018


Source: llvm-toolchain-7
Version: 7.0.1-1
Control: tags -1 patch
(warning, untested)

The "failed to find link section" errors (#913946) are gone, but there 
still aren't any -dbgsym packages.

I believe this is because clang does not include a Build ID by default 
[0], and dh_strip only builds -dbgsym packages if there is a Build ID 
[1], because it is used to set the filenames of debug symbols.

This has been the case since clang 3.9: presumably it wasn't an issue 
before because we weren't using clang to build anything that was meant 
to have a -dbgsym.  Evidence in the build log: in current logs dh_strip 
calls just strip (many times), while in older build logs dh_strip also 
calls objcopy/install/etc.

clang can be made to include a Build ID by passing -Wl,--build-id [0], 
which suggests the fix

--- a/debian/rules
+++ b/debian/rules
@@ -134,7 +134,7 @@ ifneq (,$(filter codecoverage,$(DEB_BUIL
  endif

  # Enable for bootstrap
-LDFLAGS_EXTRA            += -fPIC -Wno-unused-command-line-argument 
-Wno-unknown-warning-option
+LDFLAGS_EXTRA            += -fPIC -Wno-unused-command-line-argument 
-Wno-unknown-warning-option -Wl,--build-id
  CXXFLAGS_EXTRA           += -fPIC -Wno-unused-command-line-argument 
-Wno-unknown-warning-option
  BOOTSTRAP_CXXFLAGS_EXTRA  = $(CXXFLAGS_EXTRA) # Nothing for now. 
Keeping in case we need it
  CFLAGS_EXTRA             += -fPIC -Wno-unused-command-line-argument 
-Wno-unknown-warning-option

(I still don't know what causes #914021 = has a -dbgsym but one that 
doesn't work, and note that fixing this and not that wouldn't really be 
useful.)

[0] 
https://releases.llvm.org/3.9.0/tools/clang/docs/ReleaseNotes.html#major-new-features

Demonstration (bug913141.cpp = any valid C++ program):
$ clang++-7 -o bug913141 bug913141.cpp -lOpenCL
$ file bug913141
bug913141: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for 
GNU/Linux 3.2.0, not stripped
$ g++ -o bug913141 bug913141.cpp -lOpenCL
[irrelevant warning]
$ file bug913141
bug913141: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for 
GNU/Linux 3.2.0, BuildID[sha1]=e502d313c0518e16e2e2829fba896e8cc93618e5, 
not stripped
$ clang++-7 -o bug913141 bug913141.cpp -lOpenCL -Wl,--build-id
$ file bug913141  bug913141: ELF 64-bit LSB executable, x86-64, version 
1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, 
for GNU/Linux 3.2.0, 
BuildID[sha1]=270da52ecc76fd62e5d0fc37850f4e3a8b301a90, not stripped

[1] https://sources.debian.org/src/debhelper/11.5.4/dh_strip/?hl=292#L286



More information about the Pkg-llvm-team mailing list