This is an archive of the discontinued LLVM Phabricator instance.

[ARM64][Windows] Create COMDAT symbols for sections containing constants
AbandonedPublic

Authored by ssijaric on Jul 21 2018, 7:09 PM.

Details

Summary

As of SVN r334523, eligible constants are put in COMDAT sections in COFF on ARM64 Windows. We need to create an appropriate COMDAT symbol, just as on X86. Otherwise, the MS linker complains with something like

fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x4

and the dumpbin output shows that there is no COMDAT symbol in the section

SECTION HEADER #4

.rdata name
     0 physical address
     0 virtual address
     8 size of raw data
  6EA0 file pointer to raw data (00006EA0 to 00006EA7)
     0 file pointer to relocation table
     0 file pointer to line numbers
     0 number of relocations
     0 number of line numbers

40401040 flags

Initialized Data
COMDAT (no symbol)
8 byte align
Read Only

RAW DATA #4

00000000: .......

Diff Detail

Repository
rL LLVM

Event Timeline

ssijaric created this revision.Jul 21 2018, 7:09 PM

Funny coincidence that you post this now, I also just investigated the same issue, from a different point of view. Interestingly enough, LLD hasn't warned about it, otherwise I would have noticed much sooner.

But I'd suggest fixing this differently; since the code causing this is now in arch independent TargetLoweringObjectFileCOFF, we should also move this to an arch independent superclass, see D49644.

I'm also trying to fix this for ARM64 mingw, see D49637.

test/CodeGen/AArch64/win_cst_pool.ll
1

This new file shouldn't have executable mode

ssijaric abandoned this revision.Jul 22 2018, 3:13 PM

Abandoning, as this will be fixed in D49644.