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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 12:53:00 PDT 2024


MaskRay 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; 

Thanks for having the discussion. The motivation behind my revising this patch was the introduction of `.srodata` (#82214; sorry that I missed the discussion and I see that it landed now.), which would require different analysis from downstreams anyway.

> 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.

This summarizes the situation well. However, I want to point out that the embedded toolchain users should probably use a [configuration file](https://clang.llvm.org/docs/UsersManual.html#configuration-files) for the `-msmall-data-limit=` customization. For quite a few options with controversial defaults, the desired problem-solving principle is to pick the simple code and let downstreams customize using a configuration file.

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


More information about the cfe-commits mailing list