[libcxx-commits] [PATCH] D119969: [libc++] Unconditionally provide the ability for users to enable assertions
Dimitry Andric via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 1 07:35:35 PST 2022
dim added subscribers: emaste, dim.
dim added a comment.
In D119969#3351389 <https://reviews.llvm.org/D119969#3351389>, @ldionne wrote:
> In D119969#3349883 <https://reviews.llvm.org/D119969#3349883>, @manojgupta wrote:
>
>> Running readelf shows following in our shipping shared libs.
>>
>> 231: 00000000000c7db0 8 OBJECT GLOBAL DEFAULT 23 _ZNSt3__123__libcpp_debug_functionE
>> 668: 0000000000075160 13 FUNC GLOBAL DEFAULT 14 _ZNSt3__127__libcpp_set_debug_functionEPFvRKNS_19__libcpp_debug_infoEE
>> 1438: 0000000000075110 79 FUNC GLOBAL DEFAULT 14 _ZNSt3__129__libcpp_abort_debug_functionERKNS_19__libcpp_debug_infoE
>> 1979: 0000000000074ef0 544 FUNC GLOBAL DEFAULT 14 _ZNKSt3__119__libcpp_debug_info4whatEv
>
> Okay, right -- so as expected, you've been shipping support for the debug mode as part of the dylib, and if any user has been enabling assertions with `_LIBCPP_DEBUG=0`, they are relying on those symbols. So I think my proposed direction stands (it's this patch as-is). It's not the most elegant design since we're reusing old `__libcpp_debug_foo` for assertions, but I think it's the best decision engineering-wise for the time being.
We've got something similar on FreeBSD:
% readelf -aW /lib/libc++.so.1
...
Relocation section '.rela.dyn' at offset 0x354f8 contains 2161 entries:
...
00000000000fc6e0 0000012c00000001 R_X86_64_64 0000000000092f60 std::__1::__libcpp_abort_debug_function(std::__1::__libcpp_debug_info const&) + 0
00000000000fb130 0000019b00000006 R_X86_64_GLOB_DAT 00000000000fc6e0 std::__1::__libcpp_debug_function + 0
...
Relocation section '.rela.plt' at offset 0x41f90 contains 572 entries:
...
00000000000fca38 0000085700000007 R_X86_64_JUMP_SLOT 0000000000092d10 std::__1::__libcpp_debug_info::what() const + 0
...
Symbol table '.dynsym' contains 2398 entries:
...
300: 0000000000092f60 82 FUNC GLOBAL DEFAULT 14 std::__1::__libcpp_abort_debug_function(std::__1::__libcpp_debug_info const&)
411: 00000000000fc6e0 8 OBJECT GLOBAL DEFAULT 25 std::__1::__libcpp_debug_function
1468: 0000000000092fc0 18 FUNC GLOBAL DEFAULT 14 std::__1::__libcpp_set_debug_function(void (*)(std::__1::__libcpp_debug_info const&))
2135: 0000000000092d10 586 FUNC GLOBAL DEFAULT 14 std::__1::__libcpp_debug_info::what() const
These all originate in `debug.cpp`. I think we have been shipping it like this since we switched from libstd++ to libc++ years ago.
So this change is fine from our perspective.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119969/new/
https://reviews.llvm.org/D119969
More information about the libcxx-commits
mailing list