Hi,
Thanks, this patch is LGTM.
在 2024/3/7 上午10:56, Xi Ruoyao 写道:
On Thu, 2024-03-07 at 10:43 +0800, mengqinggang wrote:
Hi,
Whether to add an option to control the generation of R_LARCH_RELAX,
similar to as -mrelax/-mno-relax.
There are already -mrelax and -mno-relax, they can be checked in the
compiler code with TARGET_LINKER_RELAXATION.
/* snip */
+ case 'Q':
+ if (!TARGET_LINKER_RELAXATION)
+ break;
So with -mno-relax we'll break early here, then no R_LARCH_RELAX will be
printed.
+ if (code == HIGH)
+ op = XEXP (op, 0);
+
+ if (loongarch_classify_symbolic_expression (op) == SYMBOL_TLS_IE)
+ fprintf (file, ".reloc\t.,R_LARCH_RELAX\n\t");
+
+ break;
The tls-ie-norelax.c test case also checks for -mno-relax:
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcmodel=normal -mexplicit-relocs -mno-relax" } */
+/* { dg-final { scan-assembler-not "R_LARCH_RELAX" { target tls_native } } } */
i.e. -mno-relax is used compiling this test case, and the compiled
assembly code should not contain R_LARCH_RELAX.