]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
FreeBSD: Stop linking _p libs for -pg as of FreeBSD 14
authorAndreas Tobler <andreast@gcc.gnu.org>
Sun, 9 Jun 2024 21:18:04 +0000 (23:18 +0200)
committerGerald Pfeifer <gerald@pfeifer.com>
Sun, 9 Jun 2024 21:18:04 +0000 (23:18 +0200)
As of FreeBSD version 14, FreeBSD no longer provides profiled system
libraries like libc_p and libpthread_p. Stop linking against them if
the FreeBSD major version is 14 or more.

gcc:
* config/freebsd-spec.h: Change fbsd-lib-spec for FreeBSD > 13,
do not link against profiled system libraries if -pg is invoked.
Add a define to note about this change.
* config/aarch64/aarch64-freebsd.h: Use the note to inform if
-pg is invoked on FreeBSD > 13.
* config/arm/freebsd.h: Likewise.
* config/i386/freebsd.h: Likewise.
* config/i386/freebsd64.h: Likewise.
* config/riscv/freebsd.h: Likewise.
* config/rs6000/freebsd64.h: Likewise.
* config/rs6000/sysv4.h: Likeise.

gcc/config/aarch64/aarch64-freebsd.h
gcc/config/arm/freebsd.h
gcc/config/freebsd-spec.h
gcc/config/i386/freebsd.h
gcc/config/i386/freebsd64.h
gcc/config/riscv/freebsd.h
gcc/config/rs6000/freebsd64.h
gcc/config/rs6000/sysv4.h

index 53cc17a1caf05941049b2ebfb887e930bb69113c..e26d69ce46c7376402c96b846e21a6c0846ebe04 100644 (file)
@@ -35,6 +35,7 @@
 #undef  FBSD_TARGET_LINK_SPEC
 #define FBSD_TARGET_LINK_SPEC "                                 \
     %{p:%nconsider using `-pg' instead of `-p' with gprof (1)}  \
+    " FBSD_LINK_PG_NOTE "                                      \
     %{v:-V}                                                     \
     %{assert*} %{R*} %{rpath*} %{defsym*}                       \
     %{shared:-Bshareable %{h*} %{soname*}}                      \
index 9d0a5a842aba26fdd344d091de08c0d0b966f07c..ee4860ae637562086671d1e7e923eccae8174a88 100644 (file)
@@ -47,6 +47,7 @@
 #undef LINK_SPEC
 #define LINK_SPEC "                                                    \
   %{p:%nconsider using `-pg' instead of `-p' with gprof (1)}           \
+  " FBSD_LINK_PG_NOTE "                                                        \
   %{v:-V}                                                              \
   %{assert*} %{R*} %{rpath*} %{defsym*}                                        \
   %{shared:-Bshareable %{h*} %{soname*}}                               \
index a6d1ad1280fe274a93e67e5c0e3ac824a8968c75..f43056bf2cf0851327f4501fb8bb36a1c58747e0 100644 (file)
@@ -92,19 +92,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    libc, depending on whether we're doing profiling or need threads support.
    (similar to the default, except no -lg, and no -p).  */
 
+#if FBSD_MAJOR < 14
+#define FBSD_LINK_PG_NOTHREADS "%{!pg: -lc}  %{pg: -lc_p}"
+#define FBSD_LINK_PG_THREADS   "%{!pg: %{pthread:-lpthread} -lc} "     \
+                               "%{pg: %{pthread:-lpthread} -lc_p}"
+#define FBSD_LINK_PG_NOTE ""
+#else
+#define FBSD_LINK_PG_NOTHREADS "%{-lc} "
+#define FBSD_LINK_PG_THREADS   "%{pthread:-lpthread} -lc "
+#define FBSD_LINK_PG_NOTE "%{pg:%nFreeBSD no longer provides profiled "\
+                         "system libraries}"
+#endif
+
 #ifdef FBSD_NO_THREADS
 #define FBSD_LIB_SPEC "                                                        \
   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
 is built with the --enable-threads configure-time option.}             \
   %{!shared:                                                           \
-    %{!pg: -lc}                                                                \
-    %{pg:  -lc_p}                                                      \
+    " FBSD_LINK_PG_NOTHREADS "                                         \
   }"
 #else
 #define FBSD_LIB_SPEC "                                                        \
   %{!shared:                                                           \
-    %{!pg: %{pthread:-lpthread} -lc}                                   \
-    %{pg:  %{pthread:-lpthread_p} -lc_p}                               \
+    " FBSD_LINK_PG_THREADS "                                           \
   }                                                                    \
   %{shared:                                                            \
     %{pthread:-lpthread} -lc                                           \
index 3c57dc7cfae08d31307c4d92517b6225b9a1a348..583c752bb765921bb666afb342a57b835458e3ea 100644 (file)
@@ -80,6 +80,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef LINK_SPEC
 #define LINK_SPEC "\
   %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  " FBSD_LINK_PG_NOTE " \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
   %{shared:-Bshareable %{h*} %{soname*}} \
index af3fc3018b70f5ce74fa3e901463bc7a56c46c53..12985e22ef9eccbef1234827f8809b93b9ef3b3b 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #define LINK_SPEC "\
   %{m32:-m elf_i386_fbsd}%{!m32:-m elf_x86_64_fbsd} \
   %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  " FBSD_LINK_PG_NOTE " \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
   %{shared:-Bshareable %{h*} %{soname*}} \
index 5dd4d51c42bc719af9e11b8b91a844cb82680ba9..6063861e7045ebe8e4f353909521a29feb6d2cc2 100644 (file)
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
 #define LINK_SPEC "                                            \
   -melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv                  \
   %{p:%nconsider using `-pg' instead of `-p' with gprof (1)}   \
+  " FBSD_LINK_PG_NOTES "                                               \
   %{v:-V}                                                      \
   %{assert*} %{R*} %{rpath*} %{defsym*}                                \
   -X                                                           \
index 55e75cfb66a3e8cf3100519f25b744c4c22ebd63..6740170d3cc82be97865c52c3df4e591a4c458f5 100644 (file)
@@ -112,6 +112,7 @@ extern int dot_symbols;
 
 #define LINK_OS_FREEBSD_SPEC_DEF "\
   %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
+  " FBSD_LINK_PG_NOTE " \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
   %{shared:-Bshareable %{h*} %{soname*}} \
index bcafa9d0cf43261e8bd4cc8b30ac62bcf23574cc..e997dd77e5eb6c3da54f79ee959688f93f7b3fe9 100644 (file)
@@ -748,6 +748,7 @@ GNU_USER_TARGET_CC1_SPEC
 
 #define LINK_OS_FREEBSD_SPEC "\
   %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  " FBSD_LINK_PG_NOTE " \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
   %{shared:-Bshareable %{h*} %{soname*}} \