[PATCH] D110050: [Bazel] add linkopt to warn on unresolved symbols for llvm/lib/Support under FreeBSD

William Muir via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 19 21:29:04 PDT 2021


wamuir created this revision.
wamuir added a project: bazel build.
Herald added subscribers: krytarowski, arichardson, emaste.
wamuir requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

PR adds `-Wl,--warn-unresolved-symbols` to linker flags for Bazel builds of llvm/lib/Support under FreeBSD.  This avoids an error on an unresolved reference to `environ`.  As far as I can tell, on FreeBSD, `environ` is defined as a common symbol in /usr/lib/crt1.o, and won't be resolved during linking.   Ref `extern char **environ` in llvm/lib/Support/Unix/Program.inc <https://github.com/llvm/llvm-project/blob/cb42bb355061235f1c4190c8a35e59e4cfb15163/llvm/lib/Support/Unix/Program.inc#L58>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110050

Files:
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel


Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -205,6 +205,12 @@
     includes = ["include"],
     linkopts = select({
         "@bazel_tools//src/conditions:windows": [],
+        "@bazel_tools//src/conditions:freebsd": [
+            "-pthread",
+            "-ldl",
+            "-lm",
+            "-Wl,--warn-unresolved-symbols",
+        ],
         "//conditions:default": [
             "-pthread",
             "-ldl",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110050.373486.patch
Type: text/x-patch
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210920/648c6494/attachment.bin>


More information about the llvm-commits mailing list