History

Merge tag 'loongarch-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch updates from Huacai Chen: - Switch to relative exception tables - Add unaligned access support - Add alternative runtime patching mechanism - Add FDT booting support from efi system table - Add suspend/hibernation (ACPI S3/S4) support - Add basic STACKPROTECTOR support - Add ftrace (function tracer) support - Update the default config file * tag 'loongarch-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (24 commits) LoongArch: Update Loongson-3 default config file LoongArch: modules/ftrace: Initialize PLT at load time LoongArch/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support LoongArch/ftrace: Add HAVE_DYNAMIC_FTRACE_WITH_ARGS support LoongArch/ftrace: Add HAVE_DYNAMIC_FTRACE_WITH_REGS support LoongArch/ftrace: Add dynamic function graph tracer support LoongArch/ftrace: Add dynamic function tracer support LoongArch/ftrace: Add recordmcount support LoongArch/ftrace: Add basic support LoongArch: module: Use got/plt section indices for relocations LoongArch: Add basic STACKPROTECTOR support LoongArch: Add hibernation (ACPI S4) support LoongArch: Add suspend (ACPI S3) support LoongArch: Add processing ISA Node in DeviceTree LoongArch: Add FDT booting support from efi system table LoongArch: Use alternative to optimize libraries LoongArch: Add alternative runtime patching mechanism LoongArch: Add unaligned access support LoongArch: BPF: Add BPF exception tables LoongArch: Remove the .fixup section usage ...

Linus Torvalds committed 3 years ago

Commit 2f26e422 parents 96bab5b 5535f4f72 files · +3645 −187Browse files

Showing the changes to scripts (3 of 72 files). Show all

Unified · Split

3 files
  1. scripts/mod/modpost.c +13 −0
  2. scripts/recordmcount.c +39 −0
  3. scripts/sorttable.c +1 −1
scripts/mod/modpost.c+13−0
@@ -1523,6 +1523,14 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) · 1522 unmodified lines
15231523 #define R_RISCV_SUB32 39
15241524 #endif
15251525
1526+#ifndef EM_LOONGARCH
1527+#define EM_LOONGARCH 258
1528+#endif
1529+
1530+#ifndef R_LARCH_SUB32
1531+#define R_LARCH_SUB32 55
1532+#endif
1533+
15261534 static void section_rela(const char *modname, struct elf_info *elf,
15271535 Elf_Shdr *sechdr)
15281536 {
@@ -1564,6 +1572,11 @@ static void section_rela(const char *modname, struct elf_info *elf, · 35 unmodified lines
15641572 ELF_R_TYPE(r.r_info) == R_RISCV_SUB32)
15651573 continue;
15661574 break;
1575+ case EM_LOONGARCH:
1576+ if (!strcmp("__ex_table", fromsec) &&
1577+ ELF_R_TYPE(r.r_info) == R_LARCH_SUB32)
1578+ continue;
1579+ break;
15671580 }
15681581 sym = elf->symtab_start + r_sym;
15691582 /* Skip special sections */
scripts/recordmcount.c+39−0
@@ -38,6 +38,14 @@ · 37 unmodified lines
3838 #define R_AARCH64_ABS64 257
3939 #endif
4040
41+#ifndef EM_LOONGARCH
42+#define EM_LOONGARCH 258
43+#define R_LARCH_32 1
44+#define R_LARCH_64 2
45+#define R_LARCH_MARK_LA 20
46+#define R_LARCH_SOP_PUSH_PLT_PCREL 29
47+#endif
48+
4149 #define R_ARM_PC24 1
4250 #define R_ARM_THM_CALL 10
4351 #define R_ARM_CALL 28
@@ -441,6 +449,28 @@ static int arm64_is_fake_mcount(Elf64_Rel const *rp) · 397 unmodified lines
441449 return ELF64_R_TYPE(w8(rp->r_info)) != R_AARCH64_CALL26;
442450 }
443451
452+static int LARCH32_is_fake_mcount(Elf32_Rel const *rp)
453+{
454+ switch (ELF64_R_TYPE(w(rp->r_info))) {
455+ case R_LARCH_MARK_LA:
456+ case R_LARCH_SOP_PUSH_PLT_PCREL:
457+ return 0;
458+ }
459+
460+ return 1;
461+}
462+
463+static int LARCH64_is_fake_mcount(Elf64_Rel const *rp)
464+{
465+ switch (ELF64_R_TYPE(w(rp->r_info))) {
466+ case R_LARCH_MARK_LA:
467+ case R_LARCH_SOP_PUSH_PLT_PCREL:
468+ return 0;
469+ }
470+
471+ return 1;
472+}
473+
444474 /* 64-bit EM_MIPS has weird ELF64_Rela.r_info.
445475 * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
446476 * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40]
@@ -558,6 +588,7 @@ static int do_file(char const *const fname) · 111 unmodified lines
558588 break;
559589 case EM_IA_64: reltype = R_IA64_IMM64; break;
560590 case EM_MIPS: /* reltype: e_class */ break;
591+ case EM_LOONGARCH: /* reltype: e_class */ break;
561592 case EM_PPC: reltype = R_PPC_ADDR32; break;
562593 case EM_PPC64: reltype = R_PPC64_ADDR64; break;
563594 case EM_S390: /* reltype: e_class */ break;
@@ -589,6 +620,10 @@ static int do_file(char const *const fname) · 25 unmodified lines
589620 reltype = R_MIPS_32;
590621 is_fake_mcount32 = MIPS32_is_fake_mcount;
591622 }
623+ if (w2(ehdr->e_machine) == EM_LOONGARCH) {
624+ reltype = R_LARCH_32;
625+ is_fake_mcount32 = LARCH32_is_fake_mcount;
626+ }
592627 if (do32(ehdr, fname, reltype) < 0)
593628 goto out;
594629 break;
@@ -610,6 +645,10 @@ static int do_file(char const *const fname) · 15 unmodified lines
610645 Elf64_r_info = MIPS64_r_info;
611646 is_fake_mcount64 = MIPS64_is_fake_mcount;
612647 }
648+ if (w2(ghdr->e_machine) == EM_LOONGARCH) {
649+ reltype = R_LARCH_64;
650+ is_fake_mcount64 = LARCH64_is_fake_mcount;
651+ }
613652 if (do64(ghdr, fname, reltype) < 0)
614653 goto out;
615654 break;
scripts/sorttable.c+1−1
@@ -304,6 +304,7 @@ static int do_file(char const *const fname, void *addr) · 303 unmodified lines
304304 switch (r2(&ehdr->e_machine)) {
305305 case EM_386:
306306 case EM_AARCH64:
307+ case EM_LOONGARCH:
307308 case EM_RISCV:
308309 case EM_S390:
309310 case EM_X86_64:
@@ -317,7 +318,6 @@ static int do_file(char const *const fname, void *addr) · 7 unmodified lines
317318 case EM_ARCOMPACT:
318319 case EM_ARCV2:
319320 case EM_ARM:
320− case EM_LOONGARCH:
321321 case EM_MICROBLAZE:
322322 case EM_MIPS:
323323 case EM_XTENSA: