forked from OSchip/llvm-project
Fix r350643 to limit COFF emission to <= 32 BYTES instead of BITS.
The patch in r350643 incorrectly sets the COFF emission based on bits instead of bytes. This patch converts the 32 via CharUnits to bits to compare the correct values. Change-Id: Icf38a16470ad5ae3531374969c033557ddb0d323 llvm-svn: 353411
This commit is contained in:
parent
fe9bb8ff24
commit
892e633194
|
@ -3775,13 +3775,15 @@ static bool isVarDeclStrongDefinition(const ASTContext &Context,
|
|||
}
|
||||
}
|
||||
|
||||
// Microsoft's link.exe doesn't support alignments greater than 32 for common
|
||||
// symbols, so symbols with greater alignment requirements cannot be common.
|
||||
// Microsoft's link.exe doesn't support alignments greater than 32 bytes for
|
||||
// common symbols, so symbols with greater alignment requirements cannot be
|
||||
// common.
|
||||
// Other COFF linkers (ld.bfd and LLD) support arbitrary power-of-two
|
||||
// alignments for common symbols via the aligncomm directive, so this
|
||||
// restriction only applies to MSVC environments.
|
||||
if (Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() &&
|
||||
Context.getTypeAlignIfKnown(D->getType()) > 32)
|
||||
Context.getTypeAlignIfKnown(D->getType()) >
|
||||
Context.toBits(CharUnits::fromQuantity(32)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -6,3 +6,6 @@ TooLargeAlignment TooBig;
|
|||
// CHECK: @TooBig = dso_local global <16 x float> zeroinitializer, align 64
|
||||
NormalAlignment JustRight;
|
||||
// CHECK: @JustRight = common dso_local global <1 x float> zeroinitializer, align 4
|
||||
|
||||
TooLargeAlignment *IsAPointer;
|
||||
// CHECK: @IsAPointer = common dso_local global <16 x float>* null, align 8
|
||||
|
|
Loading…
Reference in New Issue