[PATCH] D102535: [RISCV] -mno-relax: emit .option norelax

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 15:37:39 PDT 2021


MaskRay added a comment.

In D102535#2760911 <https://reviews.llvm.org/D102535#2760911>, @jrtc27 wrote:

> In D102535#2760899 <https://reviews.llvm.org/D102535#2760899>, @MaskRay wrote:
>
>> In D102535#2760807 <https://reviews.llvm.org/D102535#2760807>, @jrtc27 wrote:
>>
>>> I view this as a bug in whatever calls the assembler; it should be passing -mno-relax, just as it needs to pass -fPIC as appropriate.
>>
>> I'll use the -g analogy. `clang -S -g` emits debug info and leaves a .debug_line marker so that the assembler knows it needs to synthesize debug info and should not synthesize .debug_info from ELF symbols.
>> The assembler doesn't need `-g` to function.
>>
>> For `.option nopic`, I agree it is not useful.
>
> The two aren't comparable. Relaxation affects assembling and not code generation. Debug info affects code generation to emit all the information that's otherwise lost (the assembly doesn't have a copy of your source code...). Even PIC is more useful than `.option norelax`, as it affects what instructions get used to lower global addresses etc.

I think the -Wa,-mno-relax argument is justified if code generation cannot affect relaxation (which I am unsure).

Can GCC base assembly emission decisions on -mno-relax?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102535/new/

https://reviews.llvm.org/D102535



More information about the llvm-commits mailing list