summaryrefslogtreecommitdiff
path: root/platform/linuxbsd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-21 20:52:40 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-21 20:52:40 +0100
commit271920cc547ab786f7b1b185070a538ccb05fdc7 (patch)
tree848123bac5226d55b115290a4a903fb6e6424a51 /platform/linuxbsd
parent906ee0b2193475c9de30519a1cbb99c1e7d86598 (diff)
parent2a6ce37910ac9765c36cbcc3a0a09916da4debe3 (diff)
Merge pull request #71819 from Riteo/certified-musl-moment
Make PIE relocation detection glibc-only
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp
index 8d03e3d31c..3a245460b4 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.cpp
+++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp
@@ -81,7 +81,13 @@ static void handle_crash(int sig) {
print_error(vformat("Dumping the backtrace. %s", msg));
char **strings = backtrace_symbols(bt_buffer, size);
// PIE executable relocation, zero for non-PIE executables
+#ifdef __GLIBC__
+ // This is a glibc only thing apparently.
uintptr_t relocation = _r_debug.r_map->l_addr;
+#else
+ // Non glibc systems apparently don't give PIE relocation info.
+ uintptr_t relocation = 0;
+#endif //__GLIBC__
if (strings) {
List<String> args;
for (size_t i = 0; i < size; i++) {