[PATCH] D154641: [ELF] Add --compress-sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 09:59:55 PDT 2023


peter.smith added a comment.

> I am curious how Final VMA Addresses are determined. Doesn't relocations in an uncompressed section content affect the compressed section size?

In armlink the assumption is that all VMA operates on uncompressed data. With the decompressor running very early in the startup sequence so all running code only sees uncompressed data. Compressed data is only in LMA.

I guess LLD we are making life hard by having user code do the decompression on demand rather than insist that everything is done at once by startup code

In armlink scatter file notation:

  ER_RO 0x8000 {
  # all read-only sections
    *(+ro)
  }
  ER_RW 0x10000000 {
  # all read-write sections, implicitly marked for compression
    *(+rw)
  }
  ER_ZI +0 {
  # zero initialized data follows (in VMA) after compressed RW
  }

The ER_RW load size depends on compression, but its run-time size is always the uncompressed size.

At startup, the first routine sets up a stack, usually using the space reserved for ZI, then it calls the routine to decompress all the data from LMA to VMA. User code can't easily get at the compressed data after that time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154641



More information about the llvm-commits mailing list