/* snip */

+/* If -mexplicit-relocs=auto, we use machine operations with reloc hints
+   for cases where the linker is unable to relax so we can schedule the
+   machine operations, otherwise use an assembler pseudo-op so the
+   assembler will generate R_LARCH_RELAX.  */
+
+bool
+loongarch_explicit_relocs_p (enum loongarch_symbol_type type)
+{
+  if (la_opt_explicit_relocs != EXPLICIT_RELOCS_AUTO)
+    return la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS;
+
+  /* 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 preemptable symbols.
+     So the linker cannot relax them.  */
+  return (in_lto_p
+         && !flag_incremental_link

I don’t quite understand this condition "!flag_incremental_link". Can you explain it? Others LGTM.

Thanks.

+         && HAVE_LTO_PLUGIN == 2
+         && (!global_options_set.x_flag_use_linker_plugin
+             || global_options.x_flag_use_linker_plugin)
+         && type == SYMBOL_GOT_DISP);
+}
+

Reply via email to