[PATCH] D116769: [ifs] Allow llvm-ifs to generate text stub from elf stub

Haowei Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 14:36:49 PST 2022


haowei created this revision.
haowei added reviewers: phosek, mcgrathr, jhenderson.
Herald added a subscriber: hiraditya.
haowei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ELF stubs generated from llvm-ifs lacks program headers, which prevents llvm-ifs from parsing them properly as program headers are required by llvm's own ELF libraries. This patch adds a few workaround bypass this limitation.

This patch adds DT_STRSZ into the dynamic section, which was absent previously. This was a bug and is fixed in this change.

llvm::Object::ElfFile::toMappedAddr() function requires valid program header, which was used by llvm-ifs's elf parser to determine the pointers to the strtab and dynsym sections. Instead of adding program header sections to the ELF stub output, this change just calculates the address of these pointers using offsets from the section headers when program header sections are absent.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116769

Files:
  llvm/lib/InterfaceStub/ELFObjHandler.cpp
  llvm/test/tools/llvm-ifs/ifs-elf-conversion.test
  llvm/test/tools/llvm-ifs/write-stub.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116769.397985.patch
Type: text/x-patch
Size: 4698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220106/8fdd51be/attachment.bin>


More information about the llvm-commits mailing list