Much of NOLOAD's intended use is to explicitly change the type of an output section, so we shouldn't flag these as warnings.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
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.
lld/ELF/OutputSections.cpp | ||
---|---|---|
118–119 | 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. |
lld/test/ELF/linkerscript/noload.s | ||
---|---|---|
25 | Check that there is no warning. An exact message can easily get stale. |
I think the comment is worth updating. For example