fix(llvm): keep Mach-O relocation addends out of indirect tables
This commit is contained in:
@@ -196,12 +196,12 @@ int main(void) {
|
||||
|
||||
# Cross-compile & link for arm64-apple-ios15.0 with -Wl,-dead_strip to validate ld64 PIC relocations
|
||||
bc_ios = p / 'ibr_ios.bc'
|
||||
obf_ios = p / 'ibr_ios.obf.bc'
|
||||
obf_ios = p / 'ibr_ios.obf.ll'
|
||||
obj_ios = p / 'ibr_ios.o'
|
||||
bin_ios = p / 'ibr_ios.bin'
|
||||
subprocess.run([clang, '-target', 'arm64-apple-ios15.0', '-isysroot', sdk_ios, '-Os', '-g', '-emit-llvm', '-c', str(src_c), '-o', str(bc_ios)], check=True)
|
||||
subprocess.run([
|
||||
opt_path, '-passes=ig-obfuscate',
|
||||
opt_path, '-S', '-passes=ig-obfuscate',
|
||||
f'--ig-policy={policy_path}',
|
||||
'--ig-mode=full',
|
||||
'--ig-pass-filter=all',
|
||||
@@ -209,6 +209,14 @@ int main(void) {
|
||||
f'--ig-source-path={src_c}',
|
||||
str(bc_ios), '-o', str(obf_ios),
|
||||
], check=True)
|
||||
delta_tables = [
|
||||
line for line in obf_ios.read_text(encoding='utf-8').splitlines()
|
||||
if line.startswith('@__ig_ibt1_')
|
||||
]
|
||||
self.assertTrue(delta_tables)
|
||||
for table in delta_tables:
|
||||
self.assertIn('i64 sub (', table)
|
||||
self.assertNotIn('i64 add (', table)
|
||||
subprocess.run([
|
||||
clang, '-target', 'arm64-apple-ios15.0', '-isysroot', sdk_ios, '-Os',
|
||||
'-Xclang', '-disable-llvm-passes', '-fno-builtin', '-Wno-override-module', '-g',
|
||||
|
||||
Reference in New Issue
Block a user