@@ -59,7 +59,6 @@ private sealed record SectionDefinition(CoffSectionHeader Header, Stream Stream,
59
59
private readonly HashSet < string > _referencedMethods = new ( ) ;
60
60
61
61
// Exception handling
62
- private SectionWriter _xdataSectionWriter ;
63
62
private SectionWriter _pdataSectionWriter ;
64
63
65
64
// Debugging
@@ -386,17 +385,15 @@ private protected override void EmitUnwindInfo(
386
385
387
386
if ( shareSymbol )
388
387
{
389
- // Ideally we would use `currentSymbolName` here and produce an
390
- // associative COMDAT symbol but link.exe cannot always handle that
391
- // and produces errors about duplicate symbols that point into the
392
- // associative section, so we are stuck with one section per each
393
- // unwind symbol.
388
+ // Produce an associative COMDAT symbol.
394
389
xdataSectionWriter = GetOrCreateSection ( ObjectNodeSection . XDataSection , currentSymbolName , unwindSymbolName ) ;
395
390
pdataSectionWriter = GetOrCreateSection ( PDataSection , currentSymbolName , null ) ;
396
391
}
397
392
else
398
393
{
399
- xdataSectionWriter = _xdataSectionWriter ;
394
+ // Produce a COMDAT section for each unwind symbol and let linker
395
+ // do the deduplication across the ones with identical content.
396
+ xdataSectionWriter = GetOrCreateSection ( ObjectNodeSection . XDataSection , unwindSymbolName , unwindSymbolName ) ;
400
397
pdataSectionWriter = _pdataSectionWriter ;
401
398
}
402
399
@@ -565,8 +562,7 @@ private protected override void EmitObjectFile(string objectFilePath)
565
562
566
563
private protected override void CreateEhSections ( )
567
564
{
568
- // Create .xdata and .pdata
569
- _xdataSectionWriter = GetOrCreateSection ( ObjectNodeSection . XDataSection ) ;
565
+ // Create .pdata
570
566
_pdataSectionWriter = GetOrCreateSection ( PDataSection ) ;
571
567
}
572
568
0 commit comments