builder: replace "-rdynamic" for clang on macos with "-Wl,-export_dynamic" (fix #20510) (#20511)

This commit is contained in:
awgh 2024-01-12 17:17:10 -08:00 committed by GitHub
parent abc9e06ed1
commit 6c016e51b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,7 +297,11 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
ccoptions.args << '-Wl,--no-entry'
}
if ccoptions.debug_mode && builder.current_os != 'windows' && v.pref.build_mode != .build_module {
ccoptions.linker_flags << '-rdynamic' // needed for nicer symbolic backtraces
if builder.current_os == 'macos' {
ccoptions.linker_flags << '-Wl,-export_dynamic' // clang for mac needs export_dynamic instead of -rdynamic
} else {
ccoptions.linker_flags << '-rdynamic' // needed for nicer symbolic backtraces
}
}
if v.pref.os == .freebsd {
// Needed for -usecache on FreeBSD 13, otherwise we get `ld: error: duplicate symbol: _const_math__bits__de_bruijn32` errors there