Skip to content

Commit e60b30d

Browse files
committed
Reland "D144999 [MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs."
Reasons for rolling forward: - the crash reported from Chromium was fixed in D151824 (not related to this patch at all) - since D152824 was committed, it should now be safe to roll this forward. New change: - add an additional _ in name check This reverts commit 4980eea.
1 parent 2eb84c3 commit e60b30d

38 files changed

+232
-59
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ CODEGENOPT(StackSizeSection , 1, 0) ///< Set when -fstack-size-section is enabl
114114
CODEGENOPT(ForceDwarfFrameSection , 1, 0) ///< Set when -fforce-dwarf-frame is
115115
///< enabled.
116116

117+
///< Set when -femit-compact-unwind-non-canonical is enabled.
118+
CODEGENOPT(EmitCompactUnwindNonCanonical, 1, 0)
119+
117120
///< Set when -femit-dwarf-unwind is passed.
118121
ENUM_CODEGENOPT(EmitDwarfUnwind, llvm::EmitDwarfUnwindType, 2,
119122
llvm::EmitDwarfUnwindType::Default)

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,6 +3285,9 @@ def femit_dwarf_unwind_EQ : Joined<["-"], "femit-dwarf-unwind=">,
32853285
NormalizedValues<["Always", "NoCompactUnwind", "Default"]>,
32863286
NormalizedValuesScope<"llvm::EmitDwarfUnwindType">,
32873287
MarshallingInfoEnum<CodeGenOpts<"EmitDwarfUnwind">, "Default">;
3288+
defm emit_compact_unwind_non_canonical : BoolFOption<"emit-compact-unwind-non-canonical",
3289+
CodeGenOpts<"EmitCompactUnwindNonCanonical">, DefaultFalse,
3290+
PosFlag<SetTrue, [CC1Option, CC1AsOption], "Try emitting Compact-Unwind for non-canonical entries. Maybe overriden by other constraints">, NegFlag<SetFalse>>;
32883291
def g_Flag : Flag<["-"], "g">, Group<g_Group>,
32893292
Flags<[CoreOption,FlangOption]>, HelpText<"Generate source-level debug information">;
32903293
def gline_tables_only : Flag<["-"], "gline-tables-only">, Group<gN_Group>,

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
454454

455455
Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
456456
Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
457+
Options.MCOptions.EmitCompactUnwindNonCanonical =
458+
CodeGenOpts.EmitCompactUnwindNonCanonical;
457459
Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
458460
Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;
459461
Options.MCOptions.MCUseDwarfDirectory =

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,9 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
25062506

25072507
Args.AddLastArg(CmdArgs, options::OPT_femit_dwarf_unwind_EQ);
25082508

2509+
Args.addOptInFlag(CmdArgs, options::OPT_femit_compact_unwind_non_canonical,
2510+
options::OPT_fno_emit_compact_unwind_non_canonical);
2511+
25092512
// If you add more args here, also add them to the block below that
25102513
// starts with "// If CollectArgsForIntegratedAssembler() isn't called below".
25112514

clang/test/Driver/femit-dwarf-unwind.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22

33
// RUN: rm -rf %t; mkdir %t
4-
// RUN: %clang -target x86_64-apple-macos11.0 -c %s -o %t/x86_64.o
5-
// RUN: %clang -target x86_64-apple-macos11.0 -femit-dwarf-unwind=no-compact-unwind -c %s -o %t/x86_64-no-dwarf.o
4+
// RUN: %clang -target x86_64-apple-macos11.0 -c %s -o %t/x86_64.o -femit-compact-unwind-non-canonical
5+
// RUN: %clang -target x86_64-apple-macos11.0 -femit-dwarf-unwind=no-compact-unwind -femit-compact-unwind-non-canonical -c %s -o %t/x86_64-no-dwarf.o
66
// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix=WITH-FDE
77
// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix=NO-FDE
88

clang/test/Driver/femit-dwarf-unwind.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22

33
// RUN: rm -rf %t; mkdir %t
4-
// RUN: %clang -target x86_64-apple-macos11.0 -c %s -o %t/x86_64.o
5-
// RUN: %clang -target x86_64-apple-macos11.0 -femit-dwarf-unwind=no-compact-unwind -c %s -o %t/x86_64-no-dwarf.o
4+
// RUN: %clang -target x86_64-apple-macos11.0 -c %s -o %t/x86_64.o -femit-compact-unwind-non-canonical
5+
// RUN: %clang -target x86_64-apple-macos11.0 -femit-dwarf-unwind=no-compact-unwind -c %s -o %t/x86_64-no-dwarf.o -femit-compact-unwind-non-canonical
66
// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix=WITH-FDE
77
// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix=NO-FDE
88

clang/tools/driver/cc1as_main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ struct AssemblerInvocation {
142142
/// Whether to emit DWARF unwind info.
143143
EmitDwarfUnwindType EmitDwarfUnwind;
144144

145+
// Whether to emit compact-unwind for non-canonical entries.
146+
// Note: maybe overriden by other constraints.
147+
unsigned EmitCompactUnwindNonCanonical : 1;
148+
145149
/// The name of the relocation model to use.
146150
std::string RelocationModel;
147151

@@ -181,6 +185,7 @@ struct AssemblerInvocation {
181185
DwarfVersion = 0;
182186
EmbedBitcode = 0;
183187
EmitDwarfUnwind = EmitDwarfUnwindType::Default;
188+
EmitCompactUnwindNonCanonical = false;
184189
}
185190

186191
static bool CreateFromArgs(AssemblerInvocation &Res,
@@ -348,6 +353,9 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
348353
.Case("default", EmitDwarfUnwindType::Default);
349354
}
350355

356+
Opts.EmitCompactUnwindNonCanonical =
357+
Args.hasArg(OPT_femit_compact_unwind_non_canonical);
358+
351359
Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
352360

353361
return Success;
@@ -401,6 +409,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
401409

402410
MCTargetOptions MCOptions;
403411
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
412+
MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
404413
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
405414

406415
std::unique_ptr<MCAsmInfo> MAI(

lld/MachO/UnwindInfoSection.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ void UnwindInfoSectionImpl::relocateCompactUnwind(
343343
if (!d->unwindEntry)
344344
return;
345345

346-
// If we have DWARF unwind info, create a CU entry that points to it.
346+
// If we have DWARF unwind info, create a slimmed-down CU entry that points
347+
// to it.
347348
if (d->unwindEntry->getName() == section_names::ehFrame) {
348349
// The unwinder will look for the DWARF entry starting at the hint,
349350
// assuming the hint points to a valid CFI record start. If it
@@ -360,7 +361,9 @@ void UnwindInfoSectionImpl::relocateCompactUnwind(
360361
cu.encoding = target->modeDwarfEncoding | dwarfOffsetHint;
361362
const FDE &fde = cast<ObjFile>(d->getFile())->fdes[d->unwindEntry];
362363
cu.functionLength = fde.funcLength;
363-
cu.personality = fde.personality;
364+
// Omit the DWARF personality from compact-unwind entry so that we
365+
// don't need to encode it.
366+
cu.personality = nullptr;
364367
cu.lsda = fde.lsda;
365368
return;
366369
}
0 Bytes
Binary file not shown.

lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33

44
# REQUIRES: x86
55
# RUN: rm -rf %t; split-file %s %t
6-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/user_2.s -o %t/user_2.o
7-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/user_3.s -o %t/user_3.o
6+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/user_2.s -o %t/user_2.o
7+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/user_3.s -o %t/user_3.o
8+
9+
## Test case for linking 3+ personaltiies (all globals) without crashing because all the non-canonical are DWARFs
10+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=false -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/user_4.s -o %t/user_4.o
11+
812
# RUN: yaml2obj %t/combined.yaml > %t/combined.o
913

1014
## Pre-condition: check that ___gxx_personality_v0 really is locally defined in combined.o before we proceed.
@@ -21,6 +25,12 @@
2125
## ___gxx_personality_v0 (global), ___gxx_personality_v0(local), _personality_1, and _personality_2
2226
# RUN: %lld -lSystem -dylib %t/user_3.o %t/combined.o %t/user_2.o -o %t/c.out
2327

28+
## check that we can link with 3+ personalities without crashing because
29+
## non-canonical personalities are dwarf.
30+
## This has ___gxx_personality_v0(global), ___gxx_personality_v0(local), and _personality_{1,2,3,4}
31+
## Only the ___gxx_personality_v0(global) should have compact-unwind. The rest should have DWARFs.
32+
# RUN: %lld -lSystem -lc++ %t/user_4.o %t/combined.o -o %t/d.out
33+
2434
## Postlink checks.
2535
# RUN: llvm-nm %t/a.out | FileCheck %s --check-prefix=POSTCHECK
2636
# POSTCHECK: {{.*}} U ___gxx_personality_v0
@@ -30,6 +40,8 @@
3040
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --bind %t/b.out | FileCheck %s --check-prefixes=BC,CHECK -D#%x,OFF=0x100000000
3141
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --bind %t/c.out | FileCheck %s --check-prefixes=BC,C,CHECK -D#%x,OFF=0
3242

43+
# RUN: llvm-objdump --macho --indirect-symbols --unwind-info --bind %t/d.out | FileCheck %s --check-prefixes=D -D#%x,OFF=0x100000000
44+
3345
# A: Indirect symbols for (__DATA_CONST,__got)
3446
# A-NEXT: address index name
3547
# A: 0x[[#%x,GXX_PERSONALITY_LO:]] [[#]] ___gxx_personality_v0
@@ -53,11 +65,80 @@
5365
# A-NEXT: segment section address type addend dylib symbol
5466
# A-NEXT: __DATA_CONST __got 0x[[#GXX_PERSONALITY_LO-0]] pointer 0 libc++abi ___gxx_personality_v0
5567

68+
69+
# D: Indirect symbols for (__DATA_CONST,__got)
70+
# D-NEXT: address index name
71+
# D: 0x[[#%x,GXX_PERSONALITY_HI:]] [[#]] ___gxx_personality_v0
72+
# D: 0x[[#%x,PERSONALITY_1:]] [[#]] _personality_1
73+
# D: 0x[[#%x,PERSONALITY_2:]] [[#]] _personality_2
74+
# D: 0x[[#%x,PERSONALITY_3:]] [[#]] _personality_3
75+
# D: 0x[[#%x,PERSONALITY_4:]] [[#]] _personality_4
76+
# D: 0x[[#%x,GXX_PERSONALITY_LO:]] [[#]] ___gxx_personality_v0
77+
78+
# D: Contents of __unwind_info section:
79+
# D: Personality functions: (count = 1)
80+
personality[1]: 0x{{0*}}[[#GXX_PERSONALITY_HI-OFF]]
81+
82+
# D: Bind table:
83+
# D: segment section address type addend dylib symbol
84+
# D: __DATA_CONST __got 0x[[#GXX_PERSONALITY_HI-0]] pointer 0 libc++abi ___gxx_personality_v0
85+
86+
5687
## Error cases.
5788
## Check that dylib symbols are picked (which means without libc++, we'd get an undefined symbol error.
5889
# RUN: not %lld -lSystem %t/user_2.o %t/combined.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERRORCHECK
5990
# ERRORCHECK: {{.*}} undefined symbol: ___gxx_personality_v0
6091

92+
#--- user_4.s
93+
.globl _main, _personality_1, _personality_2, _personality_3, _personality_4
94+
95+
.text
96+
97+
_baz1:
98+
.cfi_startproc
99+
.cfi_personality 155, _personality_1
100+
.cfi_def_cfa_offset 16
101+
retq
102+
.cfi_endproc
103+
104+
_baz2:
105+
.cfi_startproc
106+
.cfi_personality 155, _personality_2
107+
.cfi_def_cfa_offset 16
108+
retq
109+
.cfi_endproc
110+
111+
_baz3:
112+
.cfi_startproc
113+
.cfi_personality 155, _personality_3
114+
.cfi_def_cfa_offset 16
115+
retq
116+
.cfi_endproc
117+
118+
119+
_baz4:
120+
.cfi_startproc
121+
.cfi_personality 155, _personality_4
122+
.cfi_def_cfa_offset 16
123+
retq
124+
.cfi_endproc
125+
126+
_main:
127+
.cfi_startproc
128+
.cfi_personality 155, ___gxx_personality_v0
129+
.cfi_def_cfa_offset 16
130+
retq
131+
.cfi_endproc
132+
133+
_personality_1:
134+
retq
135+
_personality_2:
136+
retq
137+
_personality_3:
138+
retq
139+
_personality_4:
140+
retq
141+
61142
#--- user_3.s
62143
.globl _baz3
63144
.private_extern ___gxx_personality_v0

lld/test/MachO/compact-unwind-generated.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# those from the linked output
1616

1717
# RUN: %python %S/tools/generate-cfi-funcs.py --seed=johnnyapple >%t.s
18-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -o %t.o %t.s
18+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true -o %t.o %t.s
1919
# RUN: %lld -Z -L%S/Inputs/MacOSX.sdk/usr/lib -lSystem -o %t %t.o
2020
# RUN: llvm-objdump --unwind-info --syms %t %t.o >%t.dump
2121
# RUN: %python %S/tools/validate-unwind-info.py %t.dump

lld/test/MachO/compact-unwind-lsda-folding.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# REQUIRES: x86
66
# RUN: rm -rf %t; mkdir %t
7-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -o %t/lsda.o %s
7+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -emit-compact-unwind-non-canonical=true -o %t/lsda.o %s
88
# RUN: %lld -dylib --icf=all -lSystem -lc++ -o %t/liblsda.dylib %t/lsda.o
99
# RUN: llvm-objdump --macho --syms --unwind-info %t/liblsda.dylib | FileCheck %s
1010

lld/test/MachO/compact-unwind-stack-ind.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# REQUIRES: x86
2-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o
2+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %s -o %t.o
33
# RUN: %lld -arch x86_64 -dylib %t.o -o %t.dylib
44
# RUN: llvm-objdump --macho --syms --unwind-info %t.dylib | FileCheck %s
55

lld/test/MachO/compact-unwind.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# REQUIRES: x86, aarch64
22
# RUN: rm -rf %t; split-file %s %t
3-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/my-personality.s -o %t/x86_64-my-personality.o
4-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/main.s -o %t/x86_64-main.o
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/x86_64-my-personality.o
4+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/main.s -o %t/x86_64-main.o
55
# RUN: %lld -arch x86_64 -lSystem -lc++ %t/x86_64-my-personality.o %t/x86_64-main.o -o %t/x86_64-personality-first
66
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT
77
# RUN: %lld -dead_strip -arch x86_64 -lSystem -lc++ %t/x86_64-main.o %t/x86_64-my-personality.o -o %t/x86_64-personality-second
88
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT
99

10-
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 %t/my-personality.s -o %t/arm64-my-personality.o
11-
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 %t/main.s -o %t/arm64-main.o
10+
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/arm64-my-personality.o
11+
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/main.s -o %t/arm64-main.o
1212
# RUN: %lld -arch arm64 -lSystem -lc++ %t/arm64-my-personality.o %t/arm64-main.o -o %t/arm64-personality-first
1313
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT
1414
# RUN: %lld -dead_strip -arch arm64 -lSystem -lc++ %t/arm64-main.o %t/arm64-my-personality.o -o %t/arm64-personality-second
1515
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT
1616

17-
# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %t/my-personality.s -o %t/arm64-32-my-personality.o
18-
# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %t/main.s -o %t/arm64-32-main.o
17+
# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/arm64-32-my-personality.o
18+
# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos -emit-compact-unwind-non-canonical=true %t/main.s -o %t/arm64-32-main.o
1919
# RUN: %lld-watchos -lSystem -lc++ %t/arm64-32-my-personality.o %t/arm64-32-main.o -o %t/arm64-32-personality-first
2020
# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-32-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x4000 -DSEG=__TEXT
2121
# RUN: %lld-watchos -dead_strip -lSystem -lc++ %t/arm64-32-main.o %t/arm64-32-my-personality.o -o %t/arm64-32-personality-second

lld/test/MachO/eh-frame-personality-dedup.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86
22
# RUN: rm -rf %t; split-file %s %t
3-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/eh-frame.s -o %t/eh-frame.o
4-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/cu.s -o %t/cu.o
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/eh-frame.s -o %t/eh-frame.o
4+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/cu.s -o %t/cu.o
55
# RUN: %lld -dylib %t/cu.o %t/eh-frame.o -o %t/out
66

77
## Sanity check: we want our input to contain a section (and not symbol)

lld/test/MachO/eh-frame.s

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86, aarch64
22
# RUN: rm -rf %t; mkdir %t
33

4-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 %s -o %t/eh-frame-x86_64.o
4+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-macos10.15 %s -o %t/eh-frame-x86_64.o
55
# RUN: %lld -lSystem -lc++ %t/eh-frame-x86_64.o -o %t/eh-frame-x86_64
66
# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \
77
# RUN: --dwarf=frames %t/eh-frame-x86_64 | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=4
@@ -20,7 +20,7 @@
2020
# RUN: llvm-nm -m %t/eh-frame-x86_64-r | FileCheck %s --check-prefix NO-EH-SYMS
2121
# RUN: llvm-readobj --section-headers %t/eh-frame-x86_64-r | FileCheck %s --check-prefix=ALIGN -D#ALIGN=3
2222

23-
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos11.0 %s -o %t/eh-frame-arm64.o
23+
# RUN: llvm-mc -filetype=obj -emit-compact-unwind-non-canonical=true -triple=arm64-apple-macos11.0 %s -o %t/eh-frame-arm64.o
2424
# RUN: %lld -arch arm64 -lSystem -lc++ %t/eh-frame-arm64.o -o %t/eh-frame-arm64
2525
# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \
2626
# RUN: --dwarf=frames %t/eh-frame-arm64 | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=3
@@ -56,22 +56,21 @@
5656
# CHECK-DAG: [[#%x,MY_PERSONALITY:]] g F __TEXT,__text _my_personality
5757
# CHECK: Contents of __unwind_info section:
5858
# CHECK: Version: 0x1
59-
# CHECK: Number of personality functions in array: 0x2
59+
# CHECK: Number of personality functions in array: 0x1
6060
# CHECK: Number of indices in array: 0x2
61-
# CHECK: Personality functions: (count = 2)
61+
# CHECK: Personality functions: (count = 1)
6262
# CHECK: personality[1]: 0x[[#%.8x,GXX_PERSONALITY_GOT - BASE]]
63-
# CHECK: personality[2]: 0x[[#%.8x,MY_PERSONALITY_GOT - BASE]]
6463
# CHECK: LSDA descriptors:
6564
# CHECK: [0]: function offset=0x[[#%.8x,F - BASE]], LSDA offset=0x[[#%.8x,EXCEPT0 - BASE]]
6665
# CHECK: [1]: function offset=0x[[#%.8x,G - BASE]], LSDA offset=0x[[#%.8x,EXCEPT1 - BASE]]
6766
# CHECK: [2]: function offset=0x[[#%.8x,H - BASE]], LSDA offset=0x[[#%.8x,EXCEPT2 - BASE]]
6867
# CHECK: Second level indices:
6968
# CHECK: Second level index[0]:
70-
# CHECK: [0]: function offset=0x[[#%.8x,F - BASE]], encoding[{{.*}}]=0x52{{.*}}
71-
# CHECK: [1]: function offset=0x[[#%.8x,NO_UNWIND - BASE]], encoding[{{.*}}]=0x00000000
72-
# CHECK: [2]: function offset=0x[[#%.8x,G - BASE]], encoding[{{.*}}]=0x1[[#%x,DWARF_ENC]][[#%.6x, G_DWARF_OFF:]]
73-
# CHECK: [3]: function offset=0x[[#%.8x,H - BASE]], encoding[{{.*}}]=0x2[[#%x,DWARF_ENC]][[#%.6x, H_DWARF_OFF:]]
74-
# CHECK: [4]: function offset=0x[[#%.8x,MY_PERSONALITY - BASE]], encoding[{{.*}}]=0x00000000
69+
# CHECK [0]: function offset=0x[[#%.8x,F - BASE]], encoding[{{.*}}]=0x52{{.*}}
70+
# CHECK [1]: function offset=0x[[#%.8x,NO_UNWIND - BASE]], encoding[{{.*}}]=0x00000000
71+
# CHECK: [2]: function offset=0x[[#%.8x,G - BASE]], encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, G_DWARF_OFF:]]
72+
# CHECK: [3]: function offset=0x[[#%.8x,H - BASE]], encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, H_DWARF_OFF:]]
73+
# CHECK: [4]: function offset=0x[[#%.8x,MY_PERSONALITY - BASE]], encoding[{{.*}}]=0x00000000
7574

7675
# CHECK: .debug_frame contents:
7776
# CHECK: .eh_frame contents:

lld/test/MachO/icf-only-lsda-folded.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## the broken output would only appear if the compact unwind entry that pointed
1212
## to it was not itself folded.
1313

14-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/test.s -o %t/test.o
14+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/test.s -o %t/test.o
1515
# RUN: %lld -dylib -dead_strip --icf=all %t/test.o -o %t/test
1616
# RUN: llvm-objdump --macho --syms --unwind-info %t/test | FileCheck %s
1717

lld/test/MachO/icf.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## groups, we use `mov` instructions with a variety of immediates, with
88
## different immediate values for each group.
99

10-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/main.s -o %t/main.o
11-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/abs.s -o %t/abs.o
10+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/main.s -o %t/main.o
11+
# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/abs.s -o %t/abs.o
1212
# RUN: %lld -lSystem --icf=all -o %t/main %t/main.o %t/abs.o
1313
# RUN: llvm-objdump -d --syms --dwarf=frames %t/main | FileCheck %s
1414

0 commit comments

Comments
 (0)