Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37704568
en ru br
Репозитории ALT

Группа :: Разработка/C
Пакет: gcc10

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: deb-alt-gcc-as-needed.diff
Скачать


# DP: On linux targets pass --as-needed by default to the linker, but always
# DP: link the sanitizer libraries with --no-as-needed.
Index: b/src/gcc/gcc.c
===================================================================
--- a/src/gcc/gcc.c
+++ b/src/gcc/gcc.c
@@ -685,8 +685,11 @@ proper position among the other output f
 #ifdef LIBASAN_EARLY_SPEC
 #define LIBASAN_SPEC STATIC_LIBASAN_LIBS
 #elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
-		     "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
+		     " %{!static-libasan:--push-state --no-as-needed}" \
+		     " -lasan " \
+		     " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+		     " %{!static-libasan:--pop-state}" \
 		     STATIC_LIBASAN_LIBS
 #else
 #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -703,8 +706,11 @@ proper position among the other output f
 #ifdef LIBTSAN_EARLY_SPEC
 #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
 #elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
-		     "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+		     " %{!static-libtsan:--push-state --no-as-needed}" \
+		     " -ltsan " \
+		     " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+		     " %{!static-libtsan:--pop-state}" \
 		     STATIC_LIBTSAN_LIBS
 #else
 #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -721,8 +727,11 @@ proper position among the other output f
 #ifdef LIBLSAN_EARLY_SPEC
 #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
 #elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
-		     "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
+		     " %{!static-liblsan:--push-state --no-as-needed}" \
+		     " -llsan " \
+		     " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+		     " %{!static-liblsan:--pop-state}" \
 		     STATIC_LIBLSAN_LIBS
 #else
 #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -737,8 +746,11 @@ proper position among the other output f
 #define STATIC_LIBUBSAN_LIBS \
   " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
 #ifdef HAVE_LD_STATIC_DYNAMIC
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
-		     "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
+		     " %{!static-libubsan:--push-state --no-as-needed}" \
+		     " -lubsan " \
+		     " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+		     " %{!static-libubsan:--pop-state}" \
 		     STATIC_LIBUBSAN_LIBS
 #else
 #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
Index: b/src/gcc/config/gnu-user.h
===================================================================
--- a/src/gcc/config/gnu-user.h
+++ b/src/gcc/config/gnu-user.h
@@ -159,13 +159,13 @@ see the files COPYING3 and COPYING.RUNTI
 #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
   "%{static-libasan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
-  LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
+  LD_DYNAMIC_OPTION "}}%{!static-libasan:--push-state --no-as-needed -lasan --pop-state}"
 #undef LIBTSAN_EARLY_SPEC
 #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
   "%{static-libtsan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
-  LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
+  LD_DYNAMIC_OPTION "}}%{!static-libtsan:--push-state --no-as-needed -ltsan --pop-state}"
 #undef LIBLSAN_EARLY_SPEC
 #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
   "%{static-liblsan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
-  LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
+  LD_DYNAMIC_OPTION "}}%{!static-liblsan:--push-state --no-as-needed -llsan --pop-state}"
 #endif
# DP: Use --push-state/--pop-state for gold as well when linking libtsan.
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin