r353411 - Fix r350643 to limit COFF emission to <= 32 BYTES instead of BITS.
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 12 02:55:54 PST 2019
Merged to 8.0 in r353825.
On Thu, Feb 7, 2019 at 4:13 PM Erich Keane via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Thu Feb 7 07:14:11 2019
> New Revision: 353411
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353411&view=rev
> Log:
> 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
>
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/test/CodeGen/microsoft-no-common-align.c
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=353411&r1=353410&r2=353411&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Feb 7 07:14:11 2019
> @@ -3775,13 +3775,15 @@ static bool isVarDeclStrongDefinition(co
> }
> }
>
> - // 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;
>
> Modified: cfe/trunk/test/CodeGen/microsoft-no-common-align.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/microsoft-no-common-align.c?rev=353411&r1=353410&r2=353411&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/microsoft-no-common-align.c (original)
> +++ cfe/trunk/test/CodeGen/microsoft-no-common-align.c Thu Feb 7 07:14:11 2019
> @@ -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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list