Skip to content

Commit

Permalink
Handle -Wl,--whole-archive in LinkerWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
arichardson committed Jan 27, 2016
1 parent 0e1788e commit a0d62b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/generate-ir/linkerwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def parseCommandLine(self):
self.linkCandidates = []
self.sharedLibs = []
self.noDefaultLibs = False
nextArgIsLinkCandidate = False
for index, param in enumerate(self.realCommand):
if skipNextParam:
skipNextParam = False
Expand All @@ -108,6 +109,10 @@ def parseCommandLine(self):
self.mode = Mode.shared_lib
elif param == '-ffreestanding':
self.noDefaultLibs = True
elif param == '-Wl,--whole-archive':
# print("\n\n\nWHOLE ARCHIVE NEXT\n\n\n")
nextArgIsLinkCandidate = True
continue # treat next parameter as an input file
elif param.startswith('-D' + ENVVAR_NO_EMIT_IR) or param.startswith('-L' + ENVVAR_NO_EMIT_IR):
# allow selectively skipping targets by setting this #define or linker search path
# e.g. using target_compile_definitions(foo PRIVATE LLVM_IR_WRAPPER_NO_EMIT_LLVM_IR=1)
Expand All @@ -127,11 +132,13 @@ def parseCommandLine(self):
skipNextParam = True
# ignore all other -XXX flags
continue
elif nextArgIsLinkCandidate:
self.linkCandidates.append(param)
nextArgIsLinkCandidate = False
elif param.endswith('.so') or '.so.' in param or param.endswith('.a') or '.a.' in param:
# if os.path.isfile(param):
# self.linkCandidates.append(param)
# continue

# strip the directory part if it is a path
filename = os.path.basename(param)
# remove the leading lib
Expand Down

0 comments on commit a0d62b7

Please sign in to comment.