aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/loongarchelf.em
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl/loongarchelf.em')
-rw-r--r--ld/emultempl/loongarchelf.em16
1 files changed, 16 insertions, 0 deletions
diff --git a/ld/emultempl/loongarchelf.em b/ld/emultempl/loongarchelf.em
index 3bb5ddf..2da4058 100644
--- a/ld/emultempl/loongarchelf.em
+++ b/ld/emultempl/loongarchelf.em
@@ -25,6 +25,22 @@ fragment <<EOF
#include "elf/loongarch.h"
#include "elfxx-loongarch.h"
+EOF
+
+# Disable linker relaxation if set address of section or segment.
+PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
+ case OPTION_SECTION_START:
+ case OPTION_TTEXT:
+ case OPTION_TBSS:
+ case OPTION_TDATA:
+ case OPTION_TTEXT_SEGMENT:
+ case OPTION_TRODATA_SEGMENT:
+ case OPTION_TLDATA_SEGMENT:
+ link_info.disable_target_specific_optimizations = 2;
+ return false;
+'
+
+fragment <<EOF
static void
larch_elf_before_allocation (void)
{