[PATCH] D150276: [llvm-objcopy] -O binary: do not align physical addresses

Alexey Karyakin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 08:52:59 PDT 2023


quic-akaryaki created this revision.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a project: All.
quic-akaryaki requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

  llvm-objcopy should not insert padding before a section if its
  physical addresses is not aligned to section's alignment. This
  behavior will match GNU objcopy and is important for embedded images
  where the physical address is used to store the initial data image.
  The loader typically will copy this image using a start symbol
  created by the linker. If llvm-objcopy inserts padding before such a
  section, the symbol address will not match the location in the image.
  
  This commit refines the change in https://reviews.llvm.org/D128961
  which intended to align sections which type changed from NOBITS and
  their offset may not be aligned. However, it affected all sections.



Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150276

Files:
  llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
  llvm/lib/ObjCopy/ELF/ELFObject.cpp
  llvm/test/tools/llvm-objcopy/ELF/binary-paddr.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150276.521011.patch
Type: text/x-patch
Size: 4832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/0e8d4e10/attachment.bin>


More information about the llvm-commits mailing list