Commit 7568a99
authored
[dsymutil] Fix parallel linker's self-recursive typedef DIE by including referred-to types into synthetic name (#166767)
**TL;DR:** See #166675 for description of the problem, the root cause,
and one solution. This patch is the "different implementation" descried
there.
This patch tries to fix the problem by recursively including the
referred-to types into the synthetic name. This way, the synthetic name
of the typedef DIE is canonicalized. See example debug prints below:
```
SyntheticTypeNameBuilder::addDIETypeName() is called for DIE at offset 0x0000004c
SyntheticName = {H}BarInt{F}Foo<int>:() <- Two different names
Assigned to type descriptor. TypeEntryPtr = 0x0000004c0x0x150020a38 <- Hence different type entries
SyntheticTypeNameBuilder::addDIETypeName() is called for DIE at offset 0x00000044
SyntheticName = {H}BarInt{H}BarInt{F}Foo<int>:() <- Two different names
Assigned to type descriptor. TypeEntryPtr = 0x000000440x0x150020a60 <- Hence different type entries
```
The advantages of this approach over
#166675 are:
1. The resulting synthetic name is more "correct" than using decl file
and line (which _can_ still collide).
1. This doesn't depend on
#166673 to be fixed.
A **hypothetical** caveat is that it would work if any of the referenced
types resolve to the same name for some reason (similar to how the two
typedefs resolved to the same name before this patch).
# Tests
```
cd ~/public_llvm/build
bin/llvm-lit -a \
../llvm-project/llvm/test/tools/dsymutil/typedefs-with-same-name.test \
../llvm-project/llvm/test/tools/dsymutil/X86/DWARFLinkerParallel/odr-fwd-declaration.test
```1 parent 92e2404 commit 7568a99
File tree
4 files changed
+49
-6
lines changed- llvm
- lib/DWARFLinker/Parallel
- test/tools/dsymutil
- Inputs
- X86/DWARFLinkerParallel
4 files changed
+49
-6
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
| |||
Binary file not shown.
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments