[PATCH] D118793: [COFF] Move section name encoding into BinaryFormat

Nicolas Miller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 07:43:54 PST 2022


npmiller created this revision.
npmiller added a reviewer: jhenderson.
Herald added subscribers: hiraditya, mgorny.
Herald added a reviewer: alexander-shaposhnikov.
npmiller requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Large COFF section names are moved into the string table and the section header field is the offset into the string table encoded in ASCII for offset smaller than 7 digits and in base64 for larger offsets.

The operation of taking the string table offsets is done in a few places in the codebase, so it is helpful to move this operation into `BinaryFormat` so that it can be shared everywhere it's done.

So this patch takes the implementation of this operation from `llvm/lib/MC/WinCOFFObjectWriter.cpp` and moves it into `BinaryFormat`.

This is a prerequisite for https://reviews.llvm.org/D118692 that fixes an issue where `llvm-objcopy` was implementing this encoding operation incorrectly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118793

Files:
  llvm/include/llvm/BinaryFormat/COFF.h
  llvm/lib/BinaryFormat/CMakeLists.txt
  llvm/lib/BinaryFormat/COFF.cpp
  llvm/lib/MC/WinCOFFObjectWriter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118793.405263.patch
Type: text/x-patch
Size: 5304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220202/ac6327f0/attachment.bin>


More information about the llvm-commits mailing list