[PATCH] D151144: [lld][ELF] Do not emit warning for NOLOAD output sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 01:25:22 PDT 2023


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

Thanks very much for posting the alternative patch. One small suggestion to update the comment.

I had been thinking about whether it was worth distinguishing between (NOLOAD) and (TYPE=SHT_NOBITS), i.e. error for the latter but do nothing for the former. However GNU ld does not diagnose either case, and as TYPE=SHT_NOBITS is likely to be an expert level feature, it is probably best leaving as is.

Best to wait a bit to see if MaskRay has any comments as well.



================
Comment at: lld/ELF/OutputSections.cpp:119
           !canMergeToProgbits(isec->type)) {
         // Changing the type of a (NOLOAD) section is fishy, but some projects
         // (e.g. https://github.com/ClangBuiltLinux/linux/issues/1597)
----------------
I think the comment is worth updating. For example
```
The (NOLOAD) changes the section type to SHT_NOBITS, the intention is that the contents at that address is provided by some other means. Some projects (e.g. https://github.com/ClangBuiltLinux/linux/issues/1597) rely on the behavior. Other types get an error.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151144



More information about the llvm-commits mailing list