[PATCH] D67260: [yaml2obj] Set p_align to the maximum sh_addralign of containing sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 00:06:11 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, jakehehrlich, jhenderson.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The address difference between two sections in a PT_LOAD is a constant.
Consider a hypothetical case (pagesize can be very small, say, 4).

  .text     sh_addralign=4
  .text.hot sh_addralign=16

If we set p_align to 4, the PT_LOAD will be loaded to an address which
is a multiple of 4. The address of .text.hot is guaranteed to be a
multiple of 4, but not necessarily a multiple of 16.

This patch deletes the constraint

  if (SHeader->sh_offset == PHeader.p_offset)


Repository:
  rL LLVM

https://reviews.llvm.org/D67260

Files:
  lib/ObjectYAML/ELFEmitter.cpp
  test/tools/yaml2obj/program-header-align.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67260.219037.patch
Type: text/x-patch
Size: 4212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/1d1c79ed/attachment.bin>


More information about the llvm-commits mailing list