fixed a bug of XCOFFObjectFile.cpp when there is padding at the last csect of a sections.
when there is a tail padding of a section, but the value of CurrentAddressLocation do not be increased by the padding size. it will hit assert assert(CurrentAddressLocation == Section->Address && "We should have no padding between sections.");
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I really think this should probably be split, at least definitely for the commits, as there are a few separate issues going on here that don't seem related.
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
366 | Why were we previously expecting and enforcing no padding, but now we allow it? | |
422 | Is it possible to use __attribute__ ((nonstring)) instead? | |
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeablestring.ll | ||
1 ↗ | (On Diff #231543) | This should be merged with the existing tests in llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll? Also see the comment there. |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
366 | when there is a tail padding of a section, but the value of CurrentAddressLocation do not be increased by the padding size. it will hit assert assert(CurrentAddressLocation == Section->Address && "We should have no padding between sections."); | |
422 | using the attribute will caused some other compiler warning . We can not solve a warning and introduce other warning, Current fix a safety fix, I am prefer to keep it. | |
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeablestring.ll | ||
1 ↗ | (On Diff #231543) | thanks for your suggestion. |
I agree with David about splitting. There are 4 issues mentioned in this patch, and they are not related. (I'm not sure if 1 or 3 could be combine or not)
Putting them together makes it hard to review, and hard to determine if the test case actually covered the issue that's raised.
Let's make separate patches if possible.
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
366 | The assert has the effect to detecting if we assigned the section addresses in a different order than we are writing the sections. We should update the assert to indicate that "We should be writing sections consecutively." | |
382–384 | We can update CurrentAddressLocation here instead. |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
366 | thank for reminding me the problem. |
LGTM with minor comments.
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
366 | Minor nit: We have been using periods to end full sentences in asserts. Add a period here. | |
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll | ||
11 | Minor nit: We did not use two spaces before the < %s on the lines above. Let's not use it here. |
This can be merged into the loop body now