Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 2432e36

Browse files
Use response file when generating LLVM-C.dll
As discovered in D56774 the command line gets to long, so use a response file to give the script the libs. This change has been tested and is confirmed working for me. Commited on behalf of Jakob Bornecrantz Differential Revision: https://reviews.llvm.org/D56781 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351833 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 79674b6 commit 2432e36

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

tools/llvm-shlib/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,20 @@ if(MSVC)
137137
list(APPEND FULL_LIB_NAMES ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/${lib}.lib)
138138
endforeach()
139139

140+
# Need to seperate lib names with newlines.
141+
string(REPLACE ";" "\n" FILE_CONTENT "${FULL_LIB_NAMES}")
142+
143+
# Write out the full lib names into file to be read by the python script.
144+
set(LIBSFILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.args)
145+
file(WRITE ${LIBSFILE} "${FILE_CONTENT}")
146+
140147
# Generate the exports file dynamically.
141148
set(GEN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/gen-msvc-exports.py)
142149

143150
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports)
144151

145152
add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}
146-
COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} ${FULL_LIB_NAMES} ${GEN_UNDERSCORE} --nm ${LLVM_TOOLS_BINARY_DIR}/llvm-nm -o ${LLVM_EXPORTED_SYMBOL_FILE}
153+
COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} --libsfile ${LIBSFILE} ${GEN_UNDERSCORE} --nm ${LLVM_TOOLS_BINARY_DIR}/llvm-nm -o ${LLVM_EXPORTED_SYMBOL_FILE}
147154
DEPENDS ${LIB_NAMES} llvm-nm
148155
COMMENT "Generating export list for LLVM-C"
149156
VERBATIM )

tools/llvm-shlib/gen-msvc-exports.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def gen_llvm_c_export(output, underscore, libs, nm):
8282
def main():
8383
parser = argparse.ArgumentParser('gen-msvc-exports')
8484

85+
parser.add_argument(
86+
'-i', '--libsfile', help='file with list of libs, new line separated',
87+
action='store', default=None
88+
)
8589
parser.add_argument(
8690
'-o', '--output', help='output filename', default='LLVM-C.exports'
8791
)
@@ -93,12 +97,19 @@ def main():
9397
'--nm', help='path to the llvm-nm executable', default='llvm-nm'
9498
)
9599
parser.add_argument(
96-
'libs', metavar='LIBS', nargs='+', help='list of libraries to generate export from'
100+
'libs', metavar='LIBS', nargs='*', help='list of libraries to generate export from'
97101
)
98102

99103
ns = parser.parse_args()
100104

101-
gen_llvm_c_export(ns.output, ns.underscore, ns.libs, ns.nm)
105+
libs = ns.libs
106+
107+
# Add if we where given a libsfile add it to the libs.
108+
if ns.libsfile:
109+
with open(ns.libsfile) as f:
110+
libs.extend(f.read().splitlines())
111+
112+
gen_llvm_c_export(ns.output, ns.underscore, libs, ns.nm)
102113

103114

104115
if __name__ == '__main__':

0 commit comments

Comments
 (0)