summaryrefslogtreecommitdiffstats
path: root/build/build-clang/find_symbolizer_linux_clang_15.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /build/build-clang/find_symbolizer_linux_clang_15.patch
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/build-clang/find_symbolizer_linux_clang_15.patch')
-rw-r--r--build/build-clang/find_symbolizer_linux_clang_15.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/build/build-clang/find_symbolizer_linux_clang_15.patch b/build/build-clang/find_symbolizer_linux_clang_15.patch
new file mode 100644
index 0000000000..63309e8f00
--- /dev/null
+++ b/build/build-clang/find_symbolizer_linux_clang_15.patch
@@ -0,0 +1,53 @@
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
+index 7ef499ce07b1..8fd682f943fe 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
+@@ -21,6 +21,10 @@
+ #include "sanitizer_file.h"
+ # include "sanitizer_interface_internal.h"
+
++#if SANITIZER_LINUX
++#include "sanitizer_posix.h"
++#endif
++
+ namespace __sanitizer {
+
+ void CatastrophicErrorWrite(const char *buffer, uptr length) {
+@@ -206,11 +210,35 @@ char *FindPathToBinary(const char *name) {
+ return internal_strdup(name);
+ }
+
++ uptr name_len = internal_strlen(name);
++ InternalMmapVector<char> buffer(kMaxPathLength);
++
++#if SANITIZER_LINUX
++ // If we cannot find the requested binary in PATH, we should try to locate
++ // it next to the binary, in case it is shipped with the build itself
++ // (e.g. llvm-symbolizer shipped with sanitizer build to symbolize on client.
++ if (internal_readlink("/proc/self/exe", buffer.data(), kMaxPathLength) >= 0) {
++ uptr buf_len = internal_strlen(buffer.data());
++
++ /* Avoid using dirname() here */
++ while (buf_len > 0) {
++ if (buffer[buf_len - 1] == '/')
++ break;
++ buf_len--;
++ }
++
++ if (buf_len && buf_len + name_len + 1 <= kMaxPathLength) {
++ internal_memcpy(&buffer[buf_len], name, name_len);
++ buffer[buf_len + name_len] = '\0';
++ if (FileExists(buffer.data()))
++ return internal_strdup(buffer.data());
++ }
++ }
++#endif
++
+ const char *path = GetEnv("PATH");
+ if (!path)
+ return nullptr;
+- uptr name_len = internal_strlen(name);
+- InternalMmapVector<char> buffer(kMaxPathLength);
+ const char *beg = path;
+ while (true) {
+ const char *end = internal_strchrnul(beg, kPathSeparator);