[PATCH] D120645: [Object] Skip section offset checking for /<XFGHASHMAP>/

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 00:06:48 PST 2022


psamolysov-intel updated this revision to Diff 411990.
psamolysov-intel added a comment.

Thanks @jhenderson for the idea to use python to insert (or replace in my case) a section. I've updated the patch and added a test for the llvm-lib tool to list sections from a library with /<XFGHASHMAP>/. I've made a patch using the `git diff -U8000` command and I'm not sure the binary file (the library for the test) has been uploaded well. If not, could you share with me the required command to attach the binary content to the patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120645/new/

https://reviews.llvm.org/D120645

Files:
  llvm/lib/Object/Archive.cpp
  llvm/test/tools/llvm-lib/Inputs/xfghash.lib
  llvm/test/tools/llvm-lib/xfghashmap-list.test


Index: llvm/test/tools/llvm-lib/xfghashmap-list.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-lib/xfghashmap-list.test
@@ -0,0 +1,5 @@
+# This should print the /<XFGHASHMAP>/ section as well as a .dll one
+RUN: llvm-lib /list %S/Inputs/xfghash.lib | FileCheck %s
+
+CHECK: /<XFGHASHMAP>/
+CHECK: xfghash.dll
Index: llvm/lib/Object/Archive.cpp
===================================================================
--- llvm/lib/Object/Archive.cpp
+++ llvm/lib/Object/Archive.cpp
@@ -256,6 +256,10 @@
       return Name;
     if (Name.size() == 2 && Name[1] == '/') // String table.
       return Name;
+    // System libraries from Windows SDK for Window 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120645.411990.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220301/cf2b642d/attachment.bin>


More information about the llvm-commits mailing list