[PATCH] D107559: [clang] Fix libclang linking on Solaris

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 5 10:00:19 PDT 2021


ro added a comment.

In D107559#2928851 <https://reviews.llvm.org/D107559#2928851>, @tstellar wrote:

> Is there any kind of comment that is supported by all linkers?

Seems there isn't.  In that case, we could either move the comments to a separate file (`libclang.README`?), strip the comments when using
Solaris `ld` (a bit ugly), or have two separate version scripts (terrible, bound to diverge).

In D107559#2928972 <https://reviews.llvm.org/D107559#2928972>, @MaskRay wrote:

> ld.lld, GNU ld, and gold support `/* */`. I am not sure about Solaris ld -z gnu-version-script-compat.

Not sure in which way?  Support for `/* */` comments (no) or need for the option?  The latter is explained in `ld(1)`:

  -z gnu-version-script=mapfile
  -z gnu-version-script-compat
  --version-script mapfile
  
      Provides partial support for the GNU version script style  of  map-
      file.  Version  scripts are based on the original Solaris version 1
      symbol definition syntax, with some  extensions.  ld  supports  the
      most  common  such extension, the use of wildcard characters in the
      specified symbol names. Other GNU-specific extensions  may  not  be
      supported.  ld  will  issue  an appropriate error if an unsupported
      extension is encountered.
  
      For convenience in building software  developed  with  GNU  version
      scripts,  the native GNU  --version-script option is accepted as an
      alias for -z gnu-version-script. Due to the partial nature  of  the
      support  for  GNU version scripts, the use of --version-script must
      be explicitly enabled by specifying -z gnu-version-script-compat.



================
Comment at: clang/tools/libclang/libclang.map:1
-/* If you add a symbol to this file, make sure to add it with the correct
- * version.  For example, if the LLVM main branch is LLVM 14.0.0, add new
- * symbols with the version LLVM_14.
- * On platforms where versions scripts are not used, this file will be used to
- * generate a list of exports for libclang.so
- */
-
+# If you add a symbol to this file, make sure to add it with the correct
+# version.  For example, if the LLVM main branch is LLVM 14.0.0, add new
----------------
MaskRay wrote:
> GNU ld doesn't support `#` comments. ld.lld supports it.
Drats, I'd have sworn they supported `#' comments, too,
especially since the version script syntax originated with
Sun and was later adopted by GNU `ld`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107559/new/

https://reviews.llvm.org/D107559



More information about the cfe-commits mailing list