Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#58604 - [compiler-rt] do not strip libraries

Attached to Project: Arch Linux
Opened by Peter Wu (Lekensteyn) - Tuesday, 15 May 2018, 09:40 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 17 May 2018, 08:09 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


compiler-rt provides the runtime library for ASAN which also contains functions for debuggers. Due to stripping its symbols, this happens though:

$ echo 'int main(int argc, char *argv[]) {}' > main.c
$ clang -fsanitize=address -g main.c
$ gdb -q -batch -ex start -ex 'call __asan_describe_address(argv)' ./a.out
'__asan_describe_address' has unknown return type; cast the call to its declared return type

Linking against from GCC or against a local compiler-rt build with symbols gives the expected result:
$ clang -fsanitize=address -g main.c -c
$ clang main.o /usr/lib/ -pthread -ldl -lrt
$ gdb -q -batch -ex start -ex 'call __asan_describe_address(argv)' ./a.out
Address 0x7fffffffe398 is located in stack of thread T0

Current workaround is to cast the result:
(gdb) call (void)__asan_describe_address(argv)

Additional info:
* compiler-rt 6.0.0-1
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Thursday, 17 May 2018, 08:09 GMT
Reason for closing:  Deferred
Additional comments about closing:  Changed behavior in GDB 8.1 which now requires specifying return type of called function when no debug information is available. This might be resolved in the future if Arch ships debugging symbols as supplemental split packages.
Comment by Evangelos Foutras (foutrelis) - Wednesday, 16 May 2018, 10:06 GMT
With '!strip' the installed size grows from 27.95 MiB to 186.40 MiB; quite a bit more than I'd feel comfortable with.

If you know of another way to implement this, I'm open to suggestions.
Comment by Peter Wu (Lekensteyn) - Wednesday, 16 May 2018, 11:05 GMT
gcc-libs also has unstripped libraries (and ends up as 105M). It is not an excuse to do the same with compiler-rt, but might be worth considering.

Previously I looked at stripping the library and played with "-K" (--keep-symbol), but it did have the intended effect.
Other ideas:
- somehow compress the debug section
- provide a split -dbg package

Looking at what others distro do, they seem to rely on a separate debug package:
Debian/Ubuntu however do not include symbols either.
(I checked libclang-common-5.0-dev 1:5.0-3~16.04.1 on Ubuntu 16.04)

Upon further investigation, it might be an issue with GDB. Test program:
#include <stdio.h>
void foo(){puts("foo");}
int main(){}

make foo.c && strip --strip-debug foo.c
Then "p foo()" executed "foo" successfully on 7.11.1-0ubuntu1~16.5,
but not on Arch gdb 8.1 (same error as with __asan_describe_address)
Comment by Evangelos Foutras (foutrelis) - Thursday, 17 May 2018, 08:06 GMT
Quoting your closure request for reference: "This seems a "feature" of GDB 8.1. Functions without debug info are no longer assumed to return 'int'. It must be explicitly cast now (there is no setting to disable this behavior either)."

Seems like your observation is spot-on:

The new behavior appears to be documented at: (under "Calling functions with no debug info")

I guess there is not much to do here, other than Arch packaging debugging symbols separately sometime in the future (AFAIK there are no such plans yet).

Thanks for following up on this.