فهرست منبع

Merge pull request #71819 from Riteo/certified-musl-moment

Make PIE relocation detection glibc-only
Rémi Verschelde 2 سال پیش
والد
کامیت
271920cc54
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      platform/linuxbsd/crash_handler_linuxbsd.cpp

+ 6 - 0
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++) {