[clang] [llvm] [Driver] Default -msmall-data-limit= to 0 and clean up code (PR #83093)

Kito Cheng via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 06:31:28 PDT 2024


kito-cheng wrote:

There is some discussion in last (2024/2/29) LLVM sync up meeting: We all agree that might not useful in linux target and those platforms disable GP relaxation, like Android and fuchsia; However it's still useful for embedded toolchain, so this change may surprise those embedded toolchain user - cause some code size regression due to this change; although lld NOT default enable GP relaxation and also not implement all GP relaxation (`R_RISCV_PCREL_HI20` + `R_RISCV_PCREL_LO12_I` or `R_RISCV_PCREL_LO12_S` is missing), but user may use GNU linker or proprietary linker, so people would like to keep some case using same default in some case.

---

Back to the implementation - yes, GCC is not support `-G` in this case, but why clang support `-G`? it's kinda inherit from the MIPS and Hexagon, they defined `-msmall-data-threshold` and then alias to `-G`, so RISC-V also follow the same convention: `-msmall-data-limit=` is alias to `-G` (that's my understanding after archaeology, although I work with Shiva at that timing but I don't have too much memory about that).

> -mcmodel=large doesn't work for RISC-V yet, so the special case is strange.

My best guess is that is because @ShivaChen was working for Andes at that timing, and the patch is extracted from downstream source tree and it already has that logic, and no body notice that during review process...:P

[1] https://reviews.llvm.org/D57497

https://github.com/llvm/llvm-project/pull/83093


More information about the cfe-commits mailing list