Files
clang-p2996/lld/test/COFF/pdb-scopes.test
Hans Wennborg 9a9fc78744 COFF: Layout sections in the same order as link.exe
One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

Differential Revision: https://reviews.llvm.org/D45260

llvm-svn: 329221
2018-04-04 19:15:55 +00:00

76 lines
2.3 KiB
Plaintext

Consider this program:
$ cat a.c
void g(int x) {}
void f(int x);
int main(int argc) {
if (argc) {
int x = 42;
f(x);
} else {
int y = 13;
f(y);
}
}
$ cat b.c
extern void g();
void f(int x) {
if (x) {
int y = x + 3;
g(y);
} else {
int w = x + 4;
g(w);
}
}
This program is interesting because there are two TUs, and each TU has nested
scopes. Make sure we get the right parent and end offsets.
RUN: yaml2obj %S/Inputs/pdb-scopes-a.yaml -o %t-a.obj
RUN: yaml2obj %S/Inputs/pdb-scopes-b.yaml -o %t-b.obj
RUN: lld-link %t-a.obj %t-b.obj -debug -entry:main -nodefaultlib -out:%t.exe -pdb:%t.pdb
RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
CHECK-LABEL: Mod 0000 | `{{.*}}pdb-scopes.test.tmp-a.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `g`
CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 5
CHECK: debug start = 4, debug end = 4, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_GPROC32 [size = 44] `main`
CHECK: parent = 0, end = 384, addr = 0001:0016, code size = 58
CHECK: debug start = 8, debug end = 53, flags = none
CHECK: 276 | S_REGREL32 [size = 20] `argc`
CHECK: 296 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 336
CHECK: code size = 17, addr = 0001:0031
CHECK: 320 | S_REGREL32 [size = 16] `x`
CHECK: 336 | S_END [size = 4]
CHECK: 340 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 380
CHECK: code size = 17, addr = 0001:0050
CHECK: 364 | S_REGREL32 [size = 16] `y`
CHECK: 380 | S_END [size = 4]
CHECK: 384 | S_END [size = 4]
CHECK-LABEL: Mod 0001 | `{{.*}}pdb-scopes.test.tmp-b.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `f`
CHECK: parent = 0, end = 284, addr = 0001:0080, code size = 62
CHECK: debug start = 8, debug end = 57, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 236
CHECK: code size = 20, addr = 0001:0095
CHECK: 220 | S_REGREL32 [size = 16] `y`
CHECK: 236 | S_END [size = 4]
CHECK: 240 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 280
CHECK: code size = 20, addr = 0001:0117
CHECK: 264 | S_REGREL32 [size = 16] `w`
CHECK: 280 | S_END [size = 4]
CHECK: 284 | S_END [size = 4]
CHECK-LABEL: Mod 0002 | `* Linker *`: