This makes sure, that the text section will have a 2-byte alignment, if
the +c extension is enabled.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The banners were copied from other files but not updated to match the new file.
IIRC no one was opposed to this alignment change when we discussed it in a recent RISC-V sync-up call, but let's give it some time for more people to chime in.
llvm/test/MC/RISCV/align.s | ||
---|---|---|
41–44 | enable -> enabled |
llvm/lib/MC/MCObjectFileInfo.cpp | ||
---|---|---|
965 | {} = default doesn't change the fact that it is user-defined. IMHO {} is the prevailing style. | |
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp | ||
21 | Use just one variable. Don't keep Ctx | |
23 | Drop braces around simple statements. Just use ? : | |
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.h | ||
19 | Is this used? |
riscv64-linux-gnu-as -march=rv64gc a.s does use 2-byte alignment, so I think this may be fine.
I just cannot find sufficient justification for such a change.
I just cannot find sufficient justification for such a change.
So besides getting the same behavior between GCC and LLVM, this change also improves code size for RISC-V. This is because there doesn't have to be padding added between functions, if they aren't 4 byte aligned.
I'd be inclined to accept this on the basis that wherever it's not overly burdensome I've typically tried to match our output to GCC (mainly to avoid wasting time looking at irrelevant differences), and the change itself seems uncomplicated.
@flip1995: thanks for your patience, could you please rebase as this doesn't apply cleanly against current main.
If anyone has strong concerns about landing this, please speak up now!
{}
= default doesn't change the fact that it is user-defined. IMHO {} is the prevailing style.