Skip to content

Commit ad89b67

Browse files
committed
Changed segment name for MachO files.
Seems like __LLVM is now used by ld on recent Macs and that breaks our stuff. Changed the segment name for __WLLVM.
1 parent 217b976 commit ad89b67

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

driver/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
elfSectionName='.llvm_bc'
2626

2727
# These are the MACH_O segment and section name
28-
darwinSegmentName='__LLVM'
28+
# The SegmentName was __LLVM. Changed to __WLLVM to avoid clashing
29+
# with a segment that ld now uses (since MacOS X 10.11.3?)
30+
darwinSegmentName='__WLLVM'
2931
darwinSectionName='__llvm_bc'
3032

3133

extract-bc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ The above language is deliberately vague, since ELF contains a
1717
.llvm_bc section, whereas the MACH-O contains a segment called __LLVM
1818
that contains a section called __llvm_bc.
1919
20+
(Fix: 2016/02/16: __LLVM is now used by MacOS's ld so we changed the segment
21+
name to __WLLVM).
22+
2023
"""
2124

2225
import os
@@ -102,7 +105,7 @@ def getSectionContent(size, offset, filename):
102105
#use otool to extract the segment and section
103106
#iam: "xxd -r" would just refuse to play nice, so it got tossed.
104107
# if any one can get
105-
# otool -X -s __LLVM __llvm_bc inputFile | xxd -r
108+
# otool -X -s __WLLVM __llvm_bc inputFile | xxd -r
106109
# to work this can be simplified.
107110
def extract_section_darwin(inputFile):
108111

0 commit comments

Comments
 (0)