[PATCH] D74741: [ELF] Warn changed output section address

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 07:30:27 PST 2020


psmith added a comment.

Just had some thoughts on what values we warn, and what value we give as the original.



================
Comment at: lld/test/ELF/linkerscript/lma-align.test:8
 
+# WARN: warning: start of section .data changes from 0x11001 to 0x11010
+# WARN: warning: start of section .bss changes from 0x11021 to 0x11040
----------------
While the warnings look correct from the LLD last known update perspective, are they what a user would want to see? Looking at the script:

- As a user I set the address of .data to 0x11000, why is LLD reporting 0x11001? Perhaps it is worth reporting the value of the original addrexpr.
- Although "." is an addrexpr it is no different to not using an addrexpr. Could we consider addrexpr involving "." as relative to previous dot expressions and not warn? I'm not 100% behind not warning as there could be a context like . = 0x10000 ; before the addrexpr involving "." although I expect that is rare.

```
SECTIONS {
  .text 0x1000 : { *(.text*) } >ROM
  ## Input section alignment decides output section alignment.
  .data.rel.ro 0x11000 : { *(.data.rel.ro) } >RAM AT>ROM
  ## ALIGN decides output section alignment.
  .data . : ALIGN(16) { *(.data*) } >RAM AT>ROM
  ## Start a new PT_LOAD because the LMA region is different from the previous one.
  .bss . : ALIGN(64) { *(.bss*) } >RAM
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74741





More information about the llvm-commits mailing list