[PATCH] D74297: [ELF] Start a new PT_LOAD if LMA region is different

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 07:05:06 PST 2020


psmith accepted this revision.
psmith added a comment.
This revision is now accepted and ready to land.

Thanks for the update, looks good to me.
Some suggestions for the expression, not sure if they are better or not, so by all means keep the original if you prefer.

Suggestion 1, rename propagateLMA to sameLMARegion, my brain tended to lump the program header case and the same memory region under propagateLMA

  bool sameLMARegion =
      load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion;
  if (!(load && newFlags == flags && sec != relroEnd &&
        sec->memRegion == load->firstSec->memRegion &&
        (sameLMARegion || load->lastSec == Out::programHeaders)))

Suggestion 2, add `|| load->lastSec == Out::programHeaders` into propagateLMA

  bool propagateLMA =
      (load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion) || load->lastSec == Out::programHeaders;
  if (!(load && newFlags == flags && sec != relroEnd &&
        sec->memRegion == load->firstSec->memRegion &&
        propagateLMA))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74297/new/

https://reviews.llvm.org/D74297





More information about the llvm-commits mailing list