@@ -192,7 +192,8 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
192
192
'-current_version' : (1 , ArgumentListFilter .linkBinaryCallback ),
193
193
'-compatibility_version' : (1 , ArgumentListFilter .linkBinaryCallback ),
194
194
195
- # bd: need to warn the darwin user that these flags will rain on their parade
195
+ #
196
+ # BD: need to warn the darwin user that these flags will rain on their parade
196
197
# (the Darwin ld is a bit single minded)
197
198
#
198
199
# 1) compilation with -fvisibility=hidden causes trouble when we try to
@@ -202,7 +203,9 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
202
203
# 2) all stripping commands (e.g., -dead_strip) remove the __LLVM segment after
203
204
# linking
204
205
#
205
- '-fvisibility=hidden' : (0 , ArgumentListFilter .darwinWarningCompileUnaryCallback ),
206
+ # Update: found a fix for problem 1: add flag -keep_private_externs when
207
+ # calling ld -r.
208
+ #
206
209
'-Wl,-dead_strip' : (0 , ArgumentListFilter .darwinWarningLinkUnaryCallback ),
207
210
208
211
}
@@ -490,7 +493,7 @@ def attachBitcodePathToObject(bcPath, outFileName):
490
493
491
494
# Now write our bitcode section
492
495
if (sys .platform .startswith ('darwin' )):
493
- objcopyCmd = ['ld' , '-r' , outFileName , '-sectcreate' , darwinSegmentName , darwinSectionName , f .name , '-o' , outFileName ]
496
+ objcopyCmd = ['ld' , '-r' , '-keep_private_externs' , outFileName , '-sectcreate' , darwinSegmentName , darwinSectionName , f .name , '-o' , outFileName ]
494
497
else :
495
498
objcopyCmd = ['objcopy' , '--add-section' , '{0}={1}' .format (elfSectionName , f .name ), outFileName ]
496
499
orc = 0
0 commit comments