bool
loongarch_symbol_binds_local_p (const_rtx x)
{
+ if (TARGET_DIRECT_EXTERN_ACCESS)
+ return true;
+
if (SYMBOL_REF_P (x))
return (SYMBOL_REF_DECL (x)
? targetm.binds_local_p (SYMBOL_REF_DECL (x))
if (loongarch_branch_cost == 0)
loongarch_branch_cost = loongarch_cost->branch_cost;
+ if (TARGET_DIRECT_EXTERN_ACCESS && flag_shlib)
+ error ("%qs cannot be used for compiling a shared library",
+ "-mdirect-extern-access");
switch (la_target.cmodel)
{
-memcpy -mno-memcpy -mstrict-align -mno-strict-align @gol
-mmax-inline-memcpy-size=@var{n} @gol
-mexplicit-relocs -mno-explicit-relocs @gol
+-mdirect-extern-access -mno-direct-extern-access @gol
-mcmodel=@var{code-model}}
@emph{M32R/D Options}
@code{-mno-explicit-relocs} otherwise. This option is mostly useful for
debugging, or interoperation with assemblers different from the build-time
one.
+
+@item -mdirect-extern-access
+@itemx -mno-direct-extern-access
+@opindex mdirect-extern-access
+Do not use or use GOT to access external symbols. The default is
+@option{-mno-direct-extern-access}: GOT is used for external symbols with
+default visibility, but not used for other external symbols.
+
+With @option{-mdirect-extern-access}, GOT is not used and all external
+symbols are PC-relatively addressed. It is @strong{only} suitable for
+environments where no dynamic link is performed, like firmwares, OS
+kernels, executables linked with @option{-static} or @option{-static-pie}.
+@option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
+@option{-fpic}.
@end table
@node M32C Options