case SYMBOL_TLS_LE:
case SYMBOL_TLSGD:
case SYMBOL_TLSLDM:
- /* The linker don't know how to relax TLS accesses. */
+ case SYMBOL_PCREL64:
+ /* The linker don't know how to relax TLS accesses or 64-bit
+ pc-relative accesses. */
return true;
case SYMBOL_GOT_DISP:
+ /* The linker don't know how to relax GOT accesses in extreme
+ code model. */
+ if (TARGET_CMODEL_EXTREME)
+ return true;
+
/* If we are performing LTO for a final link, and we have the
linker plugin so we know the resolution of the symbols, then
all GOT references are binding to external symbols or
if (loongarch_symbol_extreme_p (symbol_type) && can_create_pseudo_p ())
{
- gcc_assert (TARGET_EXPLICIT_RELOCS);
+ gcc_assert (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE);
temp1 = gen_reg_rtx (Pmode);
emit_move_insn (temp1, gen_rtx_LO_SUM (Pmode, gen_rtx_REG (Pmode, 0),
loongarch_classify_symbolic_expression (op);
if (loongarch_symbol_extreme_p (symbol_type))
- gcc_assert (TARGET_EXPLICIT_RELOCS);
+ gcc_assert (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE);
switch (symbol_type)
{
switch (la_target.cmodel)
{
case CMODEL_EXTREME:
- if (!TARGET_EXPLICIT_RELOCS)
- error ("code model %qs needs %s",
- "extreme", "-mexplicit-relocs=always");
+ if (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)
+ error ("code model %qs is not compatible with %s",
+ "extreme", "-mexplicit-relocs=none");
if (opts->x_flag_plt)
{
*no_add_attrs = true;
return NULL_TREE;
}
- if (!TARGET_EXPLICIT_RELOCS)
+ if (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)
{
error_at (DECL_SOURCE_LOCATION (decl),
- "%qE attribute requires %s", name,
- "-mexplicit-relocs=always");
+ "%qE attribute is not compatible with %s", name,
+ "-mexplicit-relocs=none");
*no_add_attrs = true;
return NULL_TREE;
}
@item extreme
This mode does not limit the size of the code segment and data segment.
-The @option{-mcmodel=extreme} option is incompatible with @option{-fplt},
-and it requires @option{-mexplicit-relocs=always}.
+The @option{-mcmodel=extreme} option is incompatible with @option{-fplt}
+and/or @option{-mexplicit-relocs=none}.
@end table
The default code model is @code{normal}.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+
+#include "func-call-extreme-1.c"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+
+#include "func-call-extreme-1.c"