aboutsummaryrefslogtreecommitdiff
path: root/lang/gcc12
diff options
context:
space:
mode:
authorLorenzo Salvadore <salvadore@FreeBSD.org>2022-11-26 22:02:08 +0000
committerLorenzo Salvadore <salvadore@FreeBSD.org>2022-11-30 12:52:52 +0000
commit27141421f69cb2d2bc6a462d005b251921f2c52b (patch)
tree43ce3a63c6b510dd4992308066666557837bb396 /lang/gcc12
parent20320b878797d2ae1f827ac818cc31c29fbbca0b (diff)
downloadports-27141421f69cb2d2bc6a462d005b251921f2c52b.tar.gz
ports-27141421f69cb2d2bc6a462d005b251921f2c52b.zip
lang/gcc12: Fix Address sanitizer
Software compiled with -fsanitize=address fails to run with the error message "ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD". This commit fixes the issue by ignoring the [vdso] loaded shared library instead of linux-vdso.so. PR: 267751 Reported by: yuri
Diffstat (limited to 'lang/gcc12')
-rw-r--r--lang/gcc12/Makefile2
-rw-r--r--lang/gcc12/files/patch-libsanitizer_asan_asan__linux.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/lang/gcc12/Makefile b/lang/gcc12/Makefile
index 529e2595718a..5d7601f3635f 100644
--- a/lang/gcc12/Makefile
+++ b/lang/gcc12/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gcc
PORTVERSION= 12.2.0
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= lang
MASTER_SITES= GCC
PKGNAMESUFFIX= ${SUFFIX}
diff --git a/lang/gcc12/files/patch-libsanitizer_asan_asan__linux.cpp b/lang/gcc12/files/patch-libsanitizer_asan_asan__linux.cpp
new file mode 100644
index 000000000000..22630767b114
--- /dev/null
+++ b/lang/gcc12/files/patch-libsanitizer_asan_asan__linux.cpp
@@ -0,0 +1,18 @@
+Since the vDSO shared librares on Linux and FreeBSD are called
+differently, the initialization order check fails on FreeBSD.
+This patch fixes it by ignoring [vdso] instead of linux-vdso.so.
+
+GCC gets the original file from the LLVM Project, so this patch should
+probably be upstreamed directly to the LLVM Project rather than to GCC.
+
+--- libsanitizer/asan/asan_linux.cpp.orig 2022-11-23 10:52:45 UTC
++++ libsanitizer/asan/asan_linux.cpp
+@@ -135,7 +135,7 @@ static int FindFirstDSOCallback(struct dl_phdr_info *i
+ return 0;
+
+ // Ignore vDSO
+- if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
++ if (internal_strncmp(info->dlpi_name, "[vdso]", sizeof("[vdso]") - 1) == 0)
+ return 0;
+
+ #if SANITIZER_FREEBSD || SANITIZER_NETBSD