1 # RUN: rm -rf %t && mkdir -p %t && cd %t
2 # RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o a.obj %S/Inputs/a.s
3 # RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o b.obj %S/Inputs/b.s
4 # RUN: llvm-lib /out:xfghashmap.lib b.obj a.obj
6 ## Replace a section in the library file with /<XFGHASHMAP>/ emulating
7 ## a library from the Windows SDK for Windows 11.
8 # RUN: %python %s xfghashmap.lib b.obj/
10 ## This should print the /<XFGHASHMAP>/ section as well as an .obj one.
11 # RUN: llvm-lib /list %t/xfghashmap.lib | FileCheck %s
13 # CHECK: /<XFGHASHMAP>/
20 print("Use: python3 xfghashmap-list.test <LIBRARY_FILE> <TEMPLATE>")
23 template = bytes(sys.argv[2], 'utf-8')
24 xfghashmap = b'/<XFGHASHMAP>/'
27 with open(sys.argv[1], "rb") as inp:
29 with open(sys.argv[1], "wb") as outp:
30 pos = data.find(template)
31 outp.write(data[:pos])
32 outp.write(xfghashmap)
33 outp.write(data[pos + len(xfghashmap):])