[PATCH] D41718: [lld] Correctly link S_FILESTATIC records
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 14:39:10 PST 2018
zturner created this revision.
zturner added reviewers: aganea, rnk, ruiu.
`S_FILESTATIC` records are relatively rare, but cl does generate them. In particular, it seems to only generate them with optimizations turned on and a file static is en-registered into a local variable. The key piece of information in an `S_FILESTATIC` record that is not present in, for example, an `S_LOCAL` register, is the file (i.e. module) name that the file static comes from.
The prevailing theory is that this is so that if a function in module `a` which uses a file static defined in module `a` is then inlined into some other module `b`, there is a path back to the original `S_LDATA32` record.
In any case, although clang does not generate `S_FILESTATIC` records, it needs to be able to link them. This was broken before, because `S_FILESTATIC` records contain a field which refers to the string table. However, unlike other records which refer to the string table (but do so indirectly through the File Checksums table), `S_FILESTATIC` records point directly into the string table.
To handle this, during linking we need to merge in all strings from `S_FILESTATIC` records into the master PDB string table, and fixup their offsets in the linked `S_FILESTATIC` record.
This patch implements this.
This issue was originally discovered by Alexander Ganea as it was causing Visual Studio to crash.
https://reviews.llvm.org/D41718
Files:
lld/COFF/PDB.cpp
lld/test/COFF/Inputs/pdb-file-statics-a.yaml
lld/test/COFF/Inputs/pdb-file-statics-b.yaml
lld/test/COFF/pdb-file-static.test
lld/test/COFF/pdb-file-static.yaml
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/DumpOutputStyle.h
llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41718.128568.patch
Type: text/x-patch
Size: 185586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180103/03912b0b/attachment-0001.bin>
More information about the llvm-commits
mailing list