[libcxx-commits] [PATCH] D68343: [libc++] Move the linker script generation step to CMake

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 8 08:07:39 PDT 2019


ldionne marked an inline comment as done.
ldionne added a comment.

In D68343#1698655 <https://reviews.llvm.org/D68343#1698655>, @phosek wrote:

> In case of shared libraries, the libpthread and libc dependency is already encoded in the shared library itself (e.g. in case of ELF it'd be as `DT_NEEDED` entries), specifying them in the linker script is not necessary and in many cases undesirable (e.g. if your application doesn't use any threading API, you probably don't want to get implicit `DT_NEEDED` dependency on libpthread just because you're linking libc++). Where it'd make sense is for static libraries, but we don't currently generate linker script for those.


Ok. After r374053 and r374056, the linker script will contain the right dependencies.

I think this is good to go unless we're using a linker script on Windows and the redirection doesn't work, in which case I'll find a workaround.



================
Comment at: libcxx/cmake/Modules/DefineLinkerScript.cmake:46
+    COMMAND "${CMAKE_COMMAND}" -E remove "${symlink}"
+    COMMAND "${CMAKE_COMMAND}" -E echo "${linker_script}" > "${symlink}"
+    COMMENT "Generating linker script: '${linker_script}' as file ${symlink}"
----------------
phosek wrote:
> Would the file redirect (`>`) work on Windows as well?
I don't think so, but would you create a linker script on Windows? I thought this was only on Linux?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68343





More information about the libcxx-commits mailing list