[libc-commits] [PATCH] D74948: [libc] Add an optional `NAME` argument to `add_entrypoint_object` rule.
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Feb 26 21:44:12 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcab6ac2612b5: [libc] Add an optional `NAME` argument to `add_entrypoint_object` rule. (authored by sivachandra).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74948/new/
https://reviews.llvm.org/D74948
Files:
libc/cmake/modules/LLVMLibCRules.cmake
Index: libc/cmake/modules/LLVMLibCRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCRules.cmake
+++ libc/cmake/modules/LLVMLibCRules.cmake
@@ -101,6 +101,7 @@
# add_entrypoint_object(
# <target_name>
# [REDIRECTED] # Specified if the entrypoint is redirected.
+# [NAME] <the C name of the entrypoint if different from target_name>
# SRCS <list of .cpp files>
# HDRS <list of .h files>
# DEPENDS <list of dependencies>
@@ -109,7 +110,7 @@
cmake_parse_arguments(
"ADD_ENTRYPOINT_OBJ"
"REDIRECTED" # Optional argument
- "" # No single value arguments
+ "NAME" # Single value arguments
"SRCS;HDRS;DEPENDS" # Multi value arguments
${ARGN}
)
@@ -120,6 +121,11 @@
message(FATAL_ERROR "`add_entrypoint_object` rule requires HDRS to be specified.")
endif()
+ set(entrypoint_name ${target_name})
+ if(ADD_ENTRYPOINT_OBJ_NAME)
+ set(entrypoint_name ${ADD_ENTRYPOINT_OBJ_NAME})
+ endif()
+
add_library(
"${target_name}_objects"
# We want an object library as the objects will eventually get packaged into
@@ -168,7 +174,7 @@
OUTPUT ${object_file}
# We llvm-objcopy here as GNU-binutils objcopy does not support the 'hidden' flag.
DEPENDS ${object_file_raw} ${llvm-objcopy}
- COMMAND $<TARGET_FILE:llvm-objcopy> --add-symbol "${target_name}=.llvm.libc.entrypoint.${target_name}:${alias_attributes}" ${object_file_raw} ${object_file}
+ COMMAND $<TARGET_FILE:llvm-objcopy> --add-symbol "${entrypoint_name}=.llvm.libc.entrypoint.${entrypoint_name}:${alias_attributes}" ${object_file_raw} ${object_file}
)
add_custom_target(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74948.246879.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200227/3a053beb/attachment.bin>
More information about the libc-commits
mailing list