Files
clang-p2996/lld/test/pecoff/alignment.test
Rui Ueyama 71aa1a9355 [PECOFF] Fix section alignment.
If you have something like

  __declspec(align(8192)) int foo = 1;

in your code, the compiler makes the data to be aligned to 8192-byte
boundary, and the linker align the section containing the data to 8192.

LLD always aligned the section to 4192. So, as long as alignment
requirement is smaller than 4192, it was correct, but for larger
requirements, it's wrong.

This patch fixes the issue.

llvm-svn: 222043
2014-11-14 21:33:07 +00:00

23 lines
621 B
Plaintext

# RUN: yaml2obj %p/Inputs/alignment.obj.yaml > %t.obj
#
# RUN: lld -flavor link /out:%t.exe /subsystem:console /force \
# RUN: /entry:start /opt:noref -- %t.obj
# RUN: llvm-readobj -sections %t.exe | FileCheck %s
CHECK: Name: .bss (2E 62 73 73 00 00 00 00)
CHECK: RawDataSize: 0
CHECK: Name: .data (2E 64 61 74 61 00 00 00)
CHECK-NEXT: VirtualSize: 0x6
CHECK: Name: .text (2E 74 65 78 74 00 00 00)
CHECK-NEXT: VirtualSize: 0x1001
CHECK: Name: .yyy
CHECK-NEXT: VirtualSize: 0x2
CHECK-NEXT: VirtualAddress: 0x5000
CHECK: Name: .zzz
CHECK-NEXT: VirtualSize: 0x2
CHECK-NEXT: VirtualAddress: 0x8000