aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Archive.cpp
diff options
context:
space:
mode:
authorPavel Samolysov <pavel.samolysov@intel.com>2022-03-02 13:05:46 +0200
committerMartin Storsjö <martin@martin.st>2022-03-02 13:29:35 +0200
commit2397f67166156b73749e11ef1947fa34d5dbd4f7 (patch)
tree43eb8f59f8ce7bd38040f4f493b55e04157ba42c /llvm/lib/Object/Archive.cpp
parentdf0a2b4f309a2ea6a3038526722ac648d4678d47 (diff)
downloadllvm-2397f67166156b73749e11ef1947fa34d5dbd4f7.zip
llvm-2397f67166156b73749e11ef1947fa34d5dbd4f7.tar.gz
llvm-2397f67166156b73749e11ef1947fa34d5dbd4f7.tar.bz2
[Object] Skip section offset checking for /<XFGHASHMAP>/
Starting from Windows SDK for Windows 11 (10.0.22000.x), all the system libraries (.lib files) contain a section with the '/<XFGHASHMAP>/' name. This looks like the libraries are built with control flow guard enabled: https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-control-flow-guard?view=msvc-170 To let the LLVM tools (llvm-ar, llvm-lib) work with these libraries, this patch just skips the section offset check for sections with the '/<XFGHASHMAP>/' name. Closes: llvm/llvm-project#53814 Signed-off-by: Pavel Samolysov <pavel.samolysov@intel.com> Reviewed By: jhenderson, thieta Differential Revision: https://reviews.llvm.org/D120645
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 3d615f8..3960971 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -256,6 +256,10 @@ Expected<StringRef> ArchiveMemberHeader::getName(uint64_t Size) const {
return Name;
if (Name.size() == 2 && Name[1] == '/') // String table.
return Name;
+ // System libraries from the Windows SDK for Windows 11 contain this symbol.
+ // It looks like a CFG guard: we just skip it for now.
+ if (Name.equals("/<XFGHASHMAP>/"))
+ return Name;
// It's a long name.
// Get the string table offset.
std::size_t StringOffset;