On Thu, 2022-08-18 at 18:01 +0800, Lulu Cheng wrote:
> Use five instructions to calculate a signed 64-bit offset relative to the pc.
> gcc/ChangeLog:
>
> * config/loongarch/loongarch-opts.cc: Allow cmodel to be extreme.
> * config/loongarch/loongarch.cc (loongarch_call_tls_get_addr):
> Add extreme support for TLS GD and LD types.
> (loongarch_legitimize_tls_address): Add extreme support for TLS LE
> and IE.
> (loongarch_split_symbol): When compiling with -mcmodel=extreme,
> the symbol address will be obtained through five instructions.
> (loongarch_print_operand_reloc): Add support.
> (loongarch_print_operand): Add support.
> (loongarch_print_operand_address): Add support.
> (loongarch_option_override_internal): Set '-mcmodel=large' option
Should be "-mcmodel=extreme"?
> + if (!TARGET_EXPLICIT_RELOCS)
> + error ("code model %qs not support %s mode",
> + "extreme", "-mno-explicit-relocs");
Would ("code model %qs needs %s", "extreme", "-mexplicit-relocs") be
better?
> + if (opts->x_flag_plt)
> + error ("code model %qs and %qs not support %s mode",
> + "tiny-static", "extreme", "plt");
I think we can ignore the effect of -fplt if code model is extreme,
instead of forcing everyone to explicitly add -fno-plt. The "large"
code model of x86_64 also does not limit the address range and it always
avoids PLT (even if someone adds "-fplt" explicitly).
--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University