[all-commits] [llvm/llvm-project] 0c01f4: [llvm-objcopy] -O binary: align sh_offset for sect...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jul 4 21:45:37 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c01f42fad413163320c24ab4e513fbd282e4168
      https://github.com/llvm/llvm-project/commit/0c01f42fad413163320c24ab4e513fbd282e4168
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-07-04 (Mon, 04 Jul 2022)

  Changed paths:
    M llvm/lib/ObjCopy/ELF/ELFObject.cpp
    M llvm/test/tools/llvm-objcopy/ELF/binary-no-paddr.test
    M llvm/test/tools/llvm-objcopy/ELF/binary-paddr.test

  Log Message:
  -----------
  [llvm-objcopy] -O binary: align sh_offset for section changed from SHT_NOBITS

For a SHT_NOBITS section like .bss, its sh_offset is typically not
aligned by sh_addralign. If it is converted to SHT_PROGBITS by
`--set-section-flags .bss=alloc,contents`, we should conceptually align
it when computing the output size for -O binary. Otherwise the output
size may be smaller than GNU objcopy produced output.

* binary-no-paddr.test has a case with non-sensical p_paddr=1 which has
  a changed behavior. Update it.

Close https://github.com/llvm/llvm-project/issues/55246

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D128961




More information about the All-commits mailing list