https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116887
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |loongarch64-linux-gnu
CC| |chenglulu at loongson dot cn,
| |danglin at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=52999
--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
I copied something from hppa PR52999 fix:
-- >8 --
diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index dc49dca4690..b380e6f9dc4 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -11050,6 +11050,20 @@ loongarch_asm_code_end (void)
#undef DUMP_FEATURE
}
+static unsigned int
+loongarch_section_type_flags (tree decl, const char *name, int reloc)
+{
+ unsigned int flags;
+
+ flags = default_section_type_flags (decl, name, reloc);
+
+ if (strcmp (name, ".data.rel.ro") == 0
+ || strcmp (name, ".data.rel.ro.local") == 0)
+ flags |= SECTION_WRITE | SECTION_RELRO;
+
+ return flags;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -11314,6 +11328,9 @@ loongarch_asm_code_end (void)
#undef TARGET_C_MODE_FOR_FLOATING_TYPE
#define TARGET_C_MODE_FOR_FLOATING_TYPE loongarch_c_mode_for_floating_type
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS loongarch_section_type_flags
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-loongarch.h"
-- >8 --
and the code is compiled fine. But I've no idea why loongarch and hppa are
only ports requiring this...