Add method to query segments for specified output section name. Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
Details
Diff Detail
Event Timeline
test/elf/linkerscript/phdrs-invalid.test | ||
---|---|---|
11–36 | Good point, but I'd prefer to use yaml2obj for consistency with other tests in lld, and because we already have the corresponding yaml file, so there's no need to add another one with assembly code. | |
42–63 | Don't understand the purpose of separating test cases. My intent was to logically group similar tests in one file. Moreover, I won't be able to split up phdrs-default.test file above in the same fasion without test code duplication. |
test/elf/linkerscript/phdrs-invalid.test | ||
---|---|---|
11–36 | There's been discussion about this recently on the mailing lists. Whichever tool is most convenient should be used (in this case, llvm-mc is clearly the most convenient). Generally speaking, yaml2obj has been overused in LLD. |
test/elf/linkerscript/phdrs-invalid.test | ||
---|---|---|
42–63 | It's not so much about having them separate as it is about having good locality of the check lines with the actual input file (in this case the linker script). I can see the benefit in this case of having them together though. I'll leave it to another reviewer to decide on what is best in this case. |
test/elf/linkerscript/phdrs-invalid.test | ||
---|---|---|
11–36 | Actually now that I think about it (and discuss with Bigcheese), what this is testing is completely independent of the actual section content, so it doesn't make sense to have an assembly input (or an input generated from assembly). I think that yaml2obj is the right tool here, and that the test case can be significantly reduced from one generated from the one you would get from the assembly. |
include/lld/ReaderWriter/LinkerScript.h | ||
---|---|---|
1449 | Why are you storing the error here? It should be emitted when the error is encountered. Also, I think that SmallVector<..., 2> would be better here. |
Updated:
- return error immediately when encountered
- use SmallVector instead of std::vector for holding matched headers for sections
Why are you storing the error here? It should be emitted when the error is encountered. Also, I think that SmallVector<..., 2> would be better here.