= HOW (IMAGE_REL_ARM64_SECREL,
0, 4, 32, false, 0, dont, secrel_reloc, 0xffffffff);
+static const reloc_howto_type arm64_reloc_howto_secidx
+= HOW (IMAGE_REL_ARM64_SECTION,
+ 0, 2, 16, false, 0, dont, NULL, 0xffff);
+
static const reloc_howto_type* const arm64_howto_table[] = {
&arm64_reloc_howto_abs,
&arm64_reloc_howto_64,
&arm64_reloc_howto_branch14,
&arm64_reloc_howto_pgoff12a,
&arm64_reloc_howto_32nb,
- &arm64_reloc_howto_secrel
+ &arm64_reloc_howto_secrel,
+ &arm64_reloc_howto_secidx
};
/* No adjustment to addends should be needed. The actual relocation
return &arm64_reloc_howto_32nb;
case BFD_RELOC_32_SECREL:
return &arm64_reloc_howto_secrel;
+ case BFD_RELOC_16_SECIDX:
+ return &arm64_reloc_howto_secidx;
default:
BFD_FAIL ();
return NULL;
return &arm64_reloc_howto_32nb;
case IMAGE_REL_ARM64_SECREL:
return &arm64_reloc_howto_secrel;
+ case IMAGE_REL_ARM64_SECTION:
+ return &arm64_reloc_howto_secidx;
default:
return NULL;
}
break;
}
+ case IMAGE_REL_ARM64_SECTION:
+ {
+ uint16_t idx = 0, i = 1;
+ asection *s;
+
+ s = output_bfd->sections;
+ while (s)
+ {
+ if (s == sec->output_section)
+ {
+ idx = i;
+ break;
+ }
+
+ i++;
+ s = s->next;
+ }
+
+
+ bfd_putl16 (idx, contents + rel->r_vaddr);
+ rel->r_type = IMAGE_REL_ARM64_ABSOLUTE;
+
+ break;
+ }
+
default:
info->callbacks->einfo (_("%F%P: Unhandled relocation type %u\n"),
rel->r_type);
exp.X_add_number = 0;
emit_expr (&exp, size);
}
+
+static void
+s_secidx (int dummy ATTRIBUTE_UNUSED)
+{
+ expressionS exp;
+
+ do
+ {
+ expression (&exp);
+ if (exp.X_op == O_symbol)
+ exp.X_op = O_secidx;
+
+ emit_expr (&exp, 2);
+ }
+ while (*input_line_pointer++ == ',');
+
+ input_line_pointer--;
+ demand_empty_rest_of_line ();
+}
#endif /* TE_PE */
static void s_aarch64_arch (int);
#endif
#ifdef TE_PE
{"secrel32", s_secrel, 0},
+ {"secidx", s_secidx, 0},
#endif
{"float16", float_cons, 'h'},
{"bfloat16", float_cons, 'b'},
case BFD_RELOC_RVA:
case BFD_RELOC_32_SECREL:
+ case BFD_RELOC_16_SECIDX:
break;
default:
exp->X_op = O_symbol;
type = BFD_RELOC_32_SECREL;
}
+ else if (exp->X_op == O_secidx)
+ {
+ exp->X_op = O_symbol;
+ type = BFD_RELOC_16_SECIDX;
+ }
else
{
#endif
{{objdump -dr aarch64.d}} "aarch64.x"}
{".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
{{objdump -s secrel_64.d}} "secrel.x"}
+ {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
+ {{objdump -s secidx_aarch64.d}} "secidx.x"}
}
run_ld_link_tests $pe_tests
--- /dev/null
+
+tmpdir/secidx\.x: +file format pei-.*
+
+Contents of section \.text:
+ .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c .*
+ .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c .*
+ .*1020 3c3c3c3c 3e3e3e3e 3e000000 00000000 .*
+ .*1030 ffffffff ffffffff 00000000 00000000 .*
+ .*1040 ffffffff ffffffff 00000000 00000000 .*
+Contents of section \.data:
+ .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c .*
+ .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c .*
+ .*2020 3e3e3e3e 01001101 00110100 11010011 .*
+ .*2030 3c3c3c3c 3c3c3c3c 3e3e3e3e 02001102 .*
+ .*2040 00110200 11020011 3c3c3c3c 3c3c3c3c .*
+ .*2050 3e3e3e3e 03001103 00110300 11030011 .*
+ .*2060 3c3c3c3c 3c3c3c3c 3e3e3e3e 01001102 .*
+ .*2070 00110300 113c3c3c 3c3c3c3c 3c000000 .*
+ .*2080 3c3c3c3e 3e3e3e3e 3e000000 .*
+Contents of section \.rdata:
+ .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c .*
+ .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c .*
+ .*3020 3e3e3e3e 00000000 00000000 00000000 .*
+ .*3030 3c3c3c3e 3e3e3e3e 3e000000 .*
+Contents of section \.idata:
+ .*4000 00000000 00000000 00000000 00000000 .*
+ .*4010 00000000 00000000 .*