The section name encoding for `llvm-objcopy` had two main issues, the first is that the size used for the `snprintf` in the original code is incorrect because `snprintf` adds a null byte, so this code was only able to encode offsets of 6 digits - `/`, `\0` and 6 digits of the offset - rather than the 7 digits it should support. And the second part is that it didn't support the base64 encoding for offsets larger than 7 digits. This issue specifically showed up when using the `clang-offload-bundler` with a binary containing a lot of symbols/sections, since it uses `llvm-objcopy` to add the sections containing the offload code. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D118692
48 lines
1.3 KiB
CMake
48 lines
1.3 KiB
CMake
set(LLVM_LINK_COMPONENTS
|
|
Object
|
|
ObjCopy
|
|
Option
|
|
Support
|
|
MC
|
|
BinaryFormat
|
|
)
|
|
|
|
set(LLVM_TARGET_DEFINITIONS ObjcopyOpts.td)
|
|
tablegen(LLVM ObjcopyOpts.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(ObjcopyOptsTableGen)
|
|
|
|
set(LLVM_TARGET_DEFINITIONS InstallNameToolOpts.td)
|
|
tablegen(LLVM InstallNameToolOpts.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(InstallNameToolOptsTableGen)
|
|
|
|
set(LLVM_TARGET_DEFINITIONS BitcodeStripOpts.td)
|
|
tablegen(LLVM BitcodeStripOpts.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(BitcodeStripOptsTableGen)
|
|
|
|
set(LLVM_TARGET_DEFINITIONS StripOpts.td)
|
|
tablegen(LLVM StripOpts.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(StripOptsTableGen)
|
|
|
|
add_llvm_tool(llvm-objcopy
|
|
ObjcopyOptions.cpp
|
|
llvm-objcopy.cpp
|
|
DEPENDS
|
|
ObjcopyOptsTableGen
|
|
InstallNameToolOptsTableGen
|
|
StripOptsTableGen
|
|
)
|
|
|
|
add_llvm_tool_symlink(llvm-install-name-tool llvm-objcopy)
|
|
add_llvm_tool_symlink(llvm-bitcode-strip llvm-objcopy)
|
|
add_llvm_tool_symlink(llvm-strip llvm-objcopy)
|
|
|
|
if(LLVM_INSTALL_BINUTILS_SYMLINKS)
|
|
add_llvm_tool_symlink(objcopy llvm-objcopy)
|
|
add_llvm_tool_symlink(strip llvm-objcopy)
|
|
endif()
|
|
|
|
if(LLVM_INSTALL_CCTOOLS_SYMLINKS)
|
|
add_llvm_tool_symlink(install_name_tool llvm-install-name-tool)
|
|
add_llvm_tool_symlink(bitcode_strip llvm-bitcode-strip)
|
|
endif()
|