* [PATCH 2/2] Add backend support for C-SKY
2019-04-01 2:33 [PATCH 0/2] Add C-SKY support Mao Han
@ 2019-04-01 2:33 ` Mao Han
2019-04-01 2:33 ` [PATCH 1/2] libelf: Sync elf.h from glibc Mao Han
2019-04-03 20:54 ` [PATCH 0/2] Add C-SKY support Mark Wielaard
2 siblings, 0 replies; 16+ messages in thread
From: Mao Han @ 2019-04-01 2:33 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mao Han, ren_guo
---
backends/ChangeLog | 13 +++++
backends/Makefile.am | 9 +++-
backends/csky_cfi.c | 59 +++++++++++++++++++++++
backends/csky_corenote.c | 60 +++++++++++++++++++++++
backends/csky_init.c | 64 +++++++++++++++++++++++++
backends/csky_initreg.c | 85 +++++++++++++++++++++++++++++++++
backends/csky_regs.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++
backends/csky_reloc.def | 85 +++++++++++++++++++++++++++++++++
backends/csky_symbol.c | 76 +++++++++++++++++++++++++++++
libebl/eblopenbackend.c | 1 +
src/elflint.c | 2 +-
11 files changed, 572 insertions(+), 3 deletions(-)
create mode 100644 backends/csky_cfi.c
create mode 100644 backends/csky_corenote.c
create mode 100644 backends/csky_init.c
create mode 100644 backends/csky_initreg.c
create mode 100644 backends/csky_regs.c
create mode 100644 backends/csky_reloc.def
create mode 100644 backends/csky_symbol.c
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 0c61a0b..0c3193e 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,16 @@
+2019-04-01 Mao Han <han_mao@c-sky.com>
+
+ * backends/Makefile.am: Add C-SKY.
+ * backends/csky_cfi.c: New file.
+ * backends/csky_corenote.c: Likewise.
+ * backends/csky_init.c: Likewise.
+ * backends/csky_initreg.c: Likewise.
+ * backends/csky_regs.c: Likewise.
+ * backends/csky_reloc.def: Likewise.
+ * backends/csky_symbol.c: Likewise.
+ * libebl/eblopenbackend.c: Add C-SKY.
+ * src/elflint.c: Likewise.
+
2019-02-15 Mark Wielaard <mark@klomp.org>
* s390_init.c (s390_init): Hook check_special_symbol.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 2126a2e..155db8a 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -33,12 +33,13 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
- tilegx m68k bpf riscv
+ tilegx m68k bpf riscv csky
libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
- libebl_m68k_pic.a libebl_bpf_pic.a libebl_riscv_pic.a
+ libebl_m68k_pic.a libebl_bpf_pic.a libebl_riscv_pic.a \
+ libebl_csky_pic.a
noinst_LIBRARIES = $(libebl_pic)
noinst_DATA = $(libebl_pic:_pic.a=.so)
@@ -136,6 +137,10 @@ riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
libebl_riscv_pic_a_SOURCES = $(riscv_SRCS)
am_libebl_riscv_pic_a_OBJECTS = $(riscv_SRCS:.c=.os)
+csky_SRCS = csky_init.c csky_symbol.c csky_cfi.c csky_regs.c \
+ csky_initreg.c csky_corenote.c
+libebl_csky_pic_a_SOURCES = $(csky_SRCS)
+am_libebl_csky_pic_a_OBJECTS = $(csky_SRCS:.c=.os)
libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libeu)
@rm -f $(@:.so=.map)
diff --git a/backends/csky_cfi.c b/backends/csky_cfi.c
new file mode 100644
index 0000000..5c30a5f
--- /dev/null
+++ b/backends/csky_cfi.c
@@ -0,0 +1,59 @@
+/* C-SKY ABI-specified defaults for DWARF CFI.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <dwarf.h>
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+
+int
+csky_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
+{
+ static const uint8_t abi_cfi[] =
+ {
+ DW_CFA_def_cfa, ULEB128_7 (14), ULEB128_7 (0),
+ DW_CFA_val_offset, ULEB128_7 (14), ULEB128_7 (0),
+
+#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
+ SV(4), SV (5), SV (6), SV (7), SV (8), SV (9),
+ SV(10), SV (11), SV (15), SV (16), SV (17)
+#undef SV
+ };
+
+ abi_info->initial_instructions = abi_cfi;
+ abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
+ abi_info->data_alignment_factor = -4;
+
+ abi_info->return_address_register = 15; /* lr. */
+
+ return 0;
+}
diff --git a/backends/csky_corenote.c b/backends/csky_corenote.c
new file mode 100644
index 0000000..67af0b1
--- /dev/null
+++ b/backends/csky_corenote.c
@@ -0,0 +1,60 @@
+/* C-SKY specific core note handling.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <elf.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+#define ULONG uint32_t
+#define PID_T int32_t
+#define UID_T uint32_t
+#define GID_T uint32_t
+#define ALIGN_ULONG 4
+#define ALIGN_PID_T 4
+#define ALIGN_UID_T 4
+#define ALIGN_GID_T 4
+#define TYPE_ULONG ELF_T_WORD
+#define TYPE_PID_T ELF_T_SWORD
+#define TYPE_UID_T ELF_T_WORD
+#define TYPE_GID_T ELF_T_WORD
+
+static const Ebl_Register_Location prstatus_regs[] =
+ {
+ { .offset = 0, .regno = 0, .count = 38, .bits = 32 } /* r0..r31 */
+ };
+#define PRSTATUS_REGS_SIZE (38 * 4)
+
+#include "linux-core-note.c"
diff --git a/backends/csky_init.c b/backends/csky_init.c
new file mode 100644
index 0000000..fa991d0
--- /dev/null
+++ b/backends/csky_init.c
@@ -0,0 +1,64 @@
+/* Initialization of C-SKY specific backend library.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#define BACKEND csky_
+#define RELOC_PREFIX R_CKCORE_
+#include "libebl_CPU.h"
+
+/* This defines the common reloc hooks based on csky_reloc.def. */
+#include "common-reloc.c"
+
+const char *
+csky_init (Elf *elf __attribute__ ((unused)),
+ GElf_Half machine __attribute__ ((unused)),
+ Ebl *eh,
+ size_t ehlen)
+{
+ /* Check whether the Elf_BH object has a sufficent size. */
+ if (ehlen < sizeof (Ebl))
+ return NULL;
+
+ /* We handle it. */
+ eh->name = "C-SKY";
+ csky_init_reloc (eh);
+ HOOK (eh, reloc_simple_type);
+ HOOK (eh, register_info);
+ HOOK (eh, abi_cfi);
+ HOOK (eh, core_note);
+ HOOK (eh, set_initial_registers_tid);
+ HOOK (eh, machine_flag_check);
+ HOOK (eh, section_type_name);
+
+ /* gcc/config/ #define DWARF_FRAME_REGISTERS. */
+ eh->frame_nregs = 71;
+
+ return MODVERSION;
+}
diff --git a/backends/csky_initreg.c b/backends/csky_initreg.c
new file mode 100644
index 0000000..be2c252
--- /dev/null
+++ b/backends/csky_initreg.c
@@ -0,0 +1,85 @@
+/* Fetch live process registers from TID. C-SKY version.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "system.h"
+#include <assert.h>
+#if defined __CSKY__ && defined __linux__
+# include <sys/uio.h>
+# include <sys/procfs.h>
+# include <sys/ptrace.h>
+#endif
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+bool
+csky_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
+ ebl_tid_registers_t *setfunc __attribute__ ((unused)),
+ void *arg __attribute__ ((unused)))
+{
+#if !defined __CSKY__ || !defined __linux__
+ return false;
+#else /* __CSKY__ */
+ struct pt_regs user_regs;
+ struct iovec iovec;
+ iovec.iov_base = &user_regs;
+ iovec.iov_len = sizeof (user_regs);
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
+ return false;
+
+ Dwarf_Word dwarf_regs[71];
+
+ /* lr. */
+ dwarf_regs[15] = user_regs.lr;
+ /* sp. */
+ dwarf_regs[14] = user_regs.usp;
+ /* r0 ~ r13. */
+ dwarf_regs[0] = user_regs.a0;
+ dwarf_regs[1] = user_regs.a1;
+ dwarf_regs[2] = user_regs.a2;
+ dwarf_regs[3] = user_regs.a3;
+ for (int i = 4; i < 14; i++)
+ dwarf_regs[i] = user_regs.regs[i - 4];
+ /* r ~ r13. */
+ for (int i = 16; i < 31; i++)
+ dwarf_regs[i] = user_regs.exregs[i - 16];
+ /* tls. */
+ dwarf_regs[31] = user_regs.tls;
+ /* hi. */
+ dwarf_regs[34] = user_regs.rhi;
+ /* lo. */
+ dwarf_regs[35] = user_regs.rlo;
+ /* pc. */
+ dwarf_regs[70] = user_regs.pc;
+
+ return setfunc (0, 71, dwarf_regs, arg);
+#endif
+}
diff --git a/backends/csky_regs.c b/backends/csky_regs.c
new file mode 100644
index 0000000..f4390ed
--- /dev/null
+++ b/backends/csky_regs.c
@@ -0,0 +1,121 @@
+/* Register names and numbers for C-SKY DWARF.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <dwarf.h>
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+ssize_t
+csky_register_info (Ebl *ebl __attribute__ ((unused)),
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type)
+{
+ if (name == NULL)
+ return 71;
+
+ *prefix = "";
+ *bits = 38;
+ *type = DW_ATE_signed;
+ *setname = "integer";
+
+ switch (regno)
+ {
+ case 0:
+ stpcpy (name, "tls");
+ namelen = 3;
+ break;
+
+ case 1:
+ stpcpy (name, "lr");
+ namelen = 2;
+ break;
+
+ case 2:
+ stpcpy (name, "pc");
+ namelen = 2;
+ break;
+
+ case 3:
+ stpcpy (name, "sr");
+ namelen = 2;
+ break;
+
+ case 4:
+ stpcpy (name, "usp");
+ namelen = 2;
+ break;
+
+ case 5 ... 14:
+ name[0] = 'r';
+ name[1] = regno - 5 + '0';
+ namelen = 2;
+ break;
+
+ case 15 ... 24:
+ name[0] = 'r';
+ name[1] = '1';
+ name[2] = regno - 15 + '0';
+ namelen = 3;
+ break;
+
+ case 25 ... 34:
+ name[0] = 'r';
+ name[1] = '2';
+ name[2] = regno - 25 + '0';
+ namelen = 3;
+ break;
+
+ case 35:
+ stpcpy (name, "r31");
+ namelen = 3;
+ break;
+
+ case 36:
+ stpcpy (name, "hi");
+ namelen = 2;
+ break;
+
+ case 37:
+ stpcpy (name, "lo");
+ namelen = 2;
+ break;
+
+ default:
+ *setname = NULL;
+ return 0;
+ }
+
+ name[namelen++] = '\0';
+ return namelen;
+}
diff --git a/backends/csky_reloc.def b/backends/csky_reloc.def
new file mode 100644
index 0000000..c3e6c14
--- /dev/null
+++ b/backends/csky_reloc.def
@@ -0,0 +1,85 @@
+/* List the relocation types for csky. -*- C -*-
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+/* NAME, REL|EXEC|DYN */
+
+
+RELOC_TYPE (NONE, REL|EXEC|DYN)
+RELOC_TYPE (ADDR32, REL|EXEC|DYN)
+RELOC_TYPE (PCRELIMM8BY4, REL)
+RELOC_TYPE (PCRELIMM11BY2, REL)
+RELOC_TYPE (PCREL32, REL|DYN)
+RELOC_TYPE (PCRELJSR_IMM11BY2, REL)
+RELOC_TYPE (RELATIVE, EXEC|DYN)
+RELOC_TYPE (COPY, EXEC|DYN)
+RELOC_TYPE (GLOB_DAT, EXEC|DYN)
+RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
+RELOC_TYPE (GOTOFF, REL)
+RELOC_TYPE (GOTPC, REL)
+RELOC_TYPE (GOT32, REL)
+RELOC_TYPE (PLT32, REL)
+RELOC_TYPE (ADDRGOT, REL)
+RELOC_TYPE (ADDRPLT, REL)
+RELOC_TYPE (PCREL_IMM26BY2, REL)
+RELOC_TYPE (PCREL_IMM16BY2, REL)
+RELOC_TYPE (PCREL_IMM16BY4, REL)
+RELOC_TYPE (PCREL_IMM10BY2, REL)
+RELOC_TYPE (PCREL_IMM10BY4, REL)
+RELOC_TYPE (ADDR_HI16, REL|DYN)
+RELOC_TYPE (ADDR_LO16, REL|DYN)
+RELOC_TYPE (GOTPC_HI16, REL)
+RELOC_TYPE (GOTPC_LO16, REL)
+RELOC_TYPE (GOTOFF_HI16, REL)
+RELOC_TYPE (GOTOFF_LO16, REL)
+RELOC_TYPE (GOT12, REL)
+RELOC_TYPE (GOT_HI16, REL)
+RELOC_TYPE (GOT_LO16, REL)
+RELOC_TYPE (PLT12, REL)
+RELOC_TYPE (PLT_HI16, REL)
+RELOC_TYPE (PLT_LO16, REL)
+RELOC_TYPE (ADDRGOT_HI16, REL)
+RELOC_TYPE (ADDRGOT_LO16, REL)
+RELOC_TYPE (ADDRPLT_HI16, REL)
+RELOC_TYPE (ADDRPLT_LO16, REL)
+RELOC_TYPE (PCREL_JSR_IMM26BY2, REL|DYN)
+RELOC_TYPE (TOFFSET_LO16, REL)
+RELOC_TYPE (DOFFSET_LO16, REL)
+RELOC_TYPE (PCREL_IMM18BY2, REL)
+RELOC_TYPE (DOFFSET_IMM18, REL)
+RELOC_TYPE (DOFFSET_IMM18BY2, REL)
+RELOC_TYPE (DOFFSET_IMM18BY4, REL)
+RELOC_TYPE (GOT_IMM18BY4, REL)
+RELOC_TYPE (PLT_IMM18BY4, REL)
+RELOC_TYPE (PCREL_IMM7BY4, REL)
+RELOC_TYPE (TLS_LE32, REL)
+RELOC_TYPE (TLS_IE32, REL)
+RELOC_TYPE (TLS_GD32, REL)
+RELOC_TYPE (TLS_LDM32, REL)
+RELOC_TYPE (TLS_LDO32, REL)
+RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
+RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN)
+RELOC_TYPE (TLS_TPOFF32, EXEC|DYN)
diff --git a/backends/csky_symbol.c b/backends/csky_symbol.c
new file mode 100644
index 0000000..ece8131
--- /dev/null
+++ b/backends/csky_symbol.c
@@ -0,0 +1,76 @@
+/* C-SKY specific symbolic name handling.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <elf.h>
+#include <stddef.h>
+#include <string.h>
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+/* Check for the simple reloc types. */
+Elf_Type
+csky_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
+ int *addsub __attribute__ ((unused)))
+{
+ switch (type)
+ {
+ case R_CKCORE_ADDR32:
+ return ELF_T_WORD;
+ default:
+ return ELF_T_NUM;
+ }
+}
+
+bool
+csky_machine_flag_check (GElf_Word flags)
+{
+ switch (flags & EF_CSKY_ABIMASK)
+ {
+ case EF_CSKY_ABIV1:
+ case EF_CSKY_ABIV2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+const char *
+csky_section_type_name (int type,
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ if (type == SHT_CSKY_ATTRIBUTES)
+ return "CSKY_ATTRIBUTES";
+
+ return NULL;
+}
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index d54b720..e229dbd 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -135,6 +135,7 @@ static const struct
{ "bpf", "elf_bpf", "bpf", 3, EM_BPF, 0, 0 },
{ "riscv", "elf_riscv", "riscv", 5, EM_RISCV, ELFCLASS64, ELFDATA2LSB },
{ "riscv", "elf_riscv", "riscv", 5, EM_RISCV, ELFCLASS32, ELFDATA2LSB },
+ { "csky", "elf_csky", "csky", 4, EM_CSKY, ELFCLASS32, ELFDATA2LSB },
};
#define nmachines (sizeof (machines) / sizeof (machines[0]))
diff --git a/src/elflint.c b/src/elflint.c
index 810c8bd..edb466d 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -330,7 +330,7 @@ static const int valid_e_machine[] =
EM_CRIS, EM_JAVELIN, EM_FIREPATH, EM_ZSP, EM_MMIX, EM_HUANY, EM_PRISM,
EM_AVR, EM_FR30, EM_D10V, EM_D30V, EM_V850, EM_M32R, EM_MN10300,
EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA, EM_ALPHA,
- EM_TILEGX, EM_TILEPRO, EM_AARCH64, EM_BPF, EM_RISCV
+ EM_TILEGX, EM_TILEPRO, EM_AARCH64, EM_BPF, EM_RISCV, EM_CSKY
};
#define nvalid_e_machine \
(sizeof (valid_e_machine) / sizeof (valid_e_machine[0]))
--
2.7.4
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/2] Add C-SKY support
@ 2019-04-01 2:33 Mao Han
2019-04-01 2:33 ` [PATCH 2/2] Add backend support for C-SKY Mao Han
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Mao Han @ 2019-04-01 2:33 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mao Han, ren_guo
Hi,
This patch add backend support for C-SKY architecture.
Tested on X86 and got no regression.
Also tested on C-SKY qemu. I didn't find any easy way to do the cross test,
so I modified the test script to run the test suite with ssh, some testcases
fail due to the script modification.
PASS: run-arextract.sh
PASS: run-arsymtest.sh
PASS: run-ar.sh
PASS: newfile
PASS: test-nlist
PASS: update1
PASS: update2
PASS: update3
PASS: update4
PASS: run-show-die-info.sh
PASS: run-get-files.sh
PASS: run-get-lines.sh
PASS: run-next-files.sh
PASS: run-next-lines.sh
PASS: run-get-pubnames.sh
PASS: run-get-aranges.sh
PASS: run-allfcts.sh
PASS: run-show-abbrev.sh
PASS: run-line2addr.sh
PASS: hash
PASS: newscn
PASS: run-strip-test.sh
PASS: run-strip-test2.sh
PASS: run-strip-test3.sh
PASS: run-strip-test4.sh
PASS: run-strip-test5.sh
PASS: run-strip-test6.sh
PASS: run-strip-test7.sh
PASS: run-strip-test8.sh
PASS: run-strip-test9.sh
PASS: run-strip-test10.sh
PASS: run-strip-test11.sh
PASS: run-strip-test12.sh
PASS: run-strip-nothing.sh
PASS: run-strip-g.sh
PASS: run-annobingroup.sh
PASS: run-strip-groups.sh
PASS: run-strip-reloc.sh
PASS: run-strip-strmerge.sh
PASS: run-strip-nobitsalign.sh
PASS: run-strip-remove-keep.sh
PASS: run-unstrip-test.sh
PASS: run-unstrip-test2.sh
PASS: run-unstrip-test3.sh
PASS: run-unstrip-test4.sh
PASS: run-unstrip-M.sh
PASS: run-elfstrmerge-test.sh
PASS: run-ecp-test.sh
PASS: run-ecp-test2.sh
PASS: run-alldts.sh
PASS: run-elflint-test.sh
PASS: run-elflint-self.sh
PASS: run-ranlib-test.sh
PASS: run-ranlib-test2.sh
PASS: run-ranlib-test3.sh
PASS: run-ranlib-test4.sh
PASS: run-addrscopes.sh
PASS: run-strings-test.sh
PASS: run-funcscopes.sh
PASS: run-find-prologues.sh
PASS: run-allregs.sh
PASS: run-addrcfi.sh
PASS: run-dwarfcfi.sh
PASS: run-nm-self.sh
PASS: run-readelf-self.sh
PASS: run-readelf-info-plus.sh
SKIP: run-readelf-compressed.sh
PASS: run-readelf-const-values.sh
PASS: run-varlocs-self.sh
FAIL: run-exprlocs-self.sh
PASS: run-readelf-test1.sh
PASS: run-readelf-test2.sh
PASS: run-readelf-test3.sh
PASS: run-readelf-test4.sh
PASS: run-readelf-twofiles.sh
PASS: run-readelf-macro.sh
PASS: run-readelf-loc.sh
PASS: run-readelf-ranges.sh
PASS: run-readelf-aranges.sh
PASS: run-readelf-line.sh
PASS: run-readelf-z.sh
PASS: run-readelf-n.sh
FAIL: run-native-test.sh
PASS: run-bug1-test.sh
PASS: run-debuglink.sh
PASS: run-debugaltlink.sh
PASS: run-buildid.sh
PASS: dwfl-bug-addr-overflow
PASS: run-addrname-test.sh
PASS: dwfl-bug-fd-leak
PASS: dwfl-bug-report
PASS: run-dwfl-bug-offline-rel.sh
PASS: run-dwfl-addr-sect.sh
PASS: run-disasm-x86.sh
PASS: run-disasm-x86-64.sh
PASS: run-early-offscn.sh
FAIL: run-dwarf-getmacros.sh
PASS: run-dwarf-ranges.sh
PASS: run-test-flag-nobits.sh
PASS: run-prelink-addr-test.sh
PASS: run-dwarf-getstring.sh
PASS: run-rerequest_tag.sh
PASS: run-typeiter.sh
PASS: run-readelf-d.sh
PASS: run-readelf-gdb_index.sh
PASS: run-unstrip-n.sh
PASS: run-low_high_pc.sh
PASS: run-macro-test.sh
PASS: run-elf_cntl_gelf_getshdr.sh
PASS: run-test-archive64.sh
PASS: run-readelf-vmcoreinfo.sh
PASS: run-readelf-mixed-corenote.sh
PASS: run-dwfllines.sh
PASS: run-readelf-variant.sh
PASS: run-dwfl-report-elf-align.sh
PASS: run-addr2line-test.sh
PASS: run-addr2line-i-test.sh
PASS: run-addr2line-i-lex-test.sh
PASS: run-addr2line-i-demangle-test.sh
PASS: run-addr2line-alt-debugpath.sh
PASS: run-varlocs.sh
PASS: run-exprlocs.sh
PASS: run-funcretval.sh
PASS: run-backtrace-native.sh
SKIP: run-backtrace-data.sh
PASS: run-backtrace-dwarf.sh
SKIP: run-backtrace-native-biarch.sh
SKIP: run-backtrace-native-core.sh
SKIP: run-backtrace-native-core-biarch.sh
PASS: run-backtrace-core-x86_64.sh
PASS: run-backtrace-fp-core-x86_64.sh
PASS: run-backtrace-fp-core-aarch64.sh
PASS: run-backtrace-fp-core-ppc64le.sh
PASS: run-backtrace-core-x32.sh
PASS: run-backtrace-core-i386.sh
PASS: run-backtrace-fp-core-i386.sh
PASS: run-backtrace-core-ppc.sh
PASS: run-backtrace-core-s390x.sh
PASS: run-backtrace-core-s390.sh
PASS: run-backtrace-core-aarch64.sh
PASS: run-backtrace-core-sparc.sh
PASS: run-backtrace-demangle.sh
PASS: run-stack-d-test.sh
PASS: run-stack-i-test.sh
PASS: run-stack-demangled-test.sh
PASS: run-readelf-zx.sh
PASS: run-readelf-zp.sh
PASS: run-readelf-addr.sh
PASS: run-readelf-str.sh
PASS: run-readelf-types.sh
PASS: run-readelf-dwz-multi.sh
PASS: run-allfcts-multi.sh
FAIL: run-deleted.sh
PASS: run-linkmap-cut.sh
PASS: run-aggregate-size.sh
PASS: run-peel-type.sh
PASS: vdsosyms
PASS: run-readelf-A.sh
PASS: run-getsrc-die.sh
PASS: run-strptr.sh
PASS: newdata
PASS: elfstrtab
PASS: dwfl-proc-attach
PASS: elfshphehdr
PASS: run-lfs-symbols.sh
PASS: run-dwelfgnucompressed.sh
PASS: run-elfgetchdr.sh
PASS: run-elfgetzdata.sh
PASS: run-elfputzdata.sh
PASS: run-zstrptr.sh
PASS: run-compress-test.sh
PASS: run-readelf-zdebug.sh
PASS: run-readelf-zdebug-rel.sh
PASS: emptyfile
PASS: vendorelf
PASS: fillfile
PASS: dwarf_default_lower_bound
PASS: run-dwarf-die-addr-die.sh
PASS: run-get-units-invalid.sh
PASS: run-get-units-split.sh
PASS: run-attr-integrate-skel.sh
PASS: run-all-dwarf-ranges.sh
PASS: run-unit-info.sh
PASS: run-reloc-bpf.sh
PASS: run-next-cfi.sh
PASS: run-next-cfi-self.sh
PASS: run-copyadd-sections.sh
PASS: run-copymany-sections.sh
PASS: run-typeiter-many.sh
PASS: run-strip-test-many.sh
PASS: run-strip-version.sh
PASS: msg_tst
PASS: system-elf-libelf-test
PASS: asm-tst1
PASS: asm-tst2
PASS: asm-tst3
PASS: asm-tst4
PASS: asm-tst5
PASS: asm-tst6
PASS: asm-tst7
PASS: asm-tst8
PASS: asm-tst9
PASS: run-disasm-bpf.sh
============================================================================
Testsuite summary for elfutils 0.176
============================================================================
# TOTAL: 203
# PASS: 194
# SKIP: 5
# XFAIL: 0
# FAIL: 4
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to https://sourceware.org/bugzilla
============================================================================
==========================================
elfutils 0.176: tests/test-suite.log
==========================================
# TOTAL: 203
# PASS: 194
# SKIP: 5
# XFAIL: 0
# FAIL: 4
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
SKIP: run-readelf-compressed.sh
===============================
elfutils built without bzip2 support
SKIP run-readelf-compressed.sh (exit status: 77)
FAIL: run-exprlocs-self.sh
==========================
/home/vmh/elfutilswk/tests/varlocs: dwarf_getlocation_attr for addr: .debug_addr section missing
*** failure in /home/vmh/elfutilswk/tests/varlocs --exprlocs -e /home/vmh/elfutilswk/src/readelf
FAIL run-exprlocs-self.sh (exit status: 1)
FAIL: run-native-test.sh
========================
allregs: 23064: No such file or directory
FAIL run-native-test.sh (exit status: 1)
FAIL: run-dwarf-getmacros.sh
============================
--- dwarf-getmacros.out 2019-02-19 19:28:29.405840052 +0800
+++ /tmp/123 2019-02-19 19:28:27.789032052 +0800
@@ -1 +1,4 @@
-invalid opcode
+opcode 255 with 0 arguments
+file /home/petr/proj/elfutils/master/elfutils/x.c
+ FOO 0
+/file
FAIL run-dwarf-getmacros.sh (exit status: 1)
SKIP: run-backtrace-data.sh
===========================
/home/vmh/elfutilswk/tests/backtrace-data: x86_64 linux only test
SKIP run-backtrace-data.sh (exit status: 77)
SKIP: run-backtrace-native-biarch.sh
====================================
biarch testing disabled
SKIP run-backtrace-native-biarch.sh (exit status: 77)
SKIP: run-backtrace-native-core.sh
==================================
Aborted
No core.12362 file generated
SKIP run-backtrace-native-core.sh (exit status: 77)
SKIP: run-backtrace-native-core-biarch.sh
=========================================
biarch testing disabled
SKIP run-backtrace-native-core-biarch.sh (exit status: 77)
FAIL: run-deleted.sh
====================
PID 12587 - process
TID 12587:
#0 0x2ab79648 sleep
#1 0x2ab79648 sleep
#2 0x2aace6a4
/home/vmh/elfutilswk/src/stack: dwfl_thread_getframes tid 12587 at 0x2aace6a3 in /home/vmh/elfutilswk/tests/test-25076/deleted-lib.so: Callback returned failure
./run-deleted.sh: line 38: kill: (12587) - No such process
FAIL run-deleted.sh (exit status: 1)
Mao Han (2):
libelf: Sync elf.h from glibc
Add backend support for C-SKY
backends/ChangeLog | 13 +++++
backends/Makefile.am | 9 +++-
backends/csky_cfi.c | 59 +++++++++++++++++++++++
backends/csky_corenote.c | 60 +++++++++++++++++++++++
backends/csky_init.c | 64 +++++++++++++++++++++++++
backends/csky_initreg.c | 85 +++++++++++++++++++++++++++++++++
backends/csky_regs.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++
backends/csky_reloc.def | 85 +++++++++++++++++++++++++++++++++
backends/csky_symbol.c | 76 +++++++++++++++++++++++++++++
libebl/eblopenbackend.c | 1 +
libelf/ChangeLog | 4 ++
libelf/elf.h | 96 ++++++++++++++++++++++++++++++++++++-
src/elflint.c | 2 +-
13 files changed, 670 insertions(+), 5 deletions(-)
create mode 100644 backends/csky_cfi.c
create mode 100644 backends/csky_corenote.c
create mode 100644 backends/csky_init.c
create mode 100644 backends/csky_initreg.c
create mode 100644 backends/csky_regs.c
create mode 100644 backends/csky_reloc.def
create mode 100644 backends/csky_symbol.c
--
2.7.4
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from glibc
2019-04-01 2:33 [PATCH 0/2] Add C-SKY support Mao Han
2019-04-01 2:33 ` [PATCH 2/2] Add backend support for C-SKY Mao Han
@ 2019-04-01 2:33 ` Mao Han
2019-04-03 20:54 ` [PATCH 0/2] Add C-SKY support Mark Wielaard
2 siblings, 0 replies; 16+ messages in thread
From: Mao Han @ 2019-04-01 2:33 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mao Han, ren_guo
---
libelf/ChangeLog | 4 +++
libelf/elf.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index d9b7749..d3bdac3 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2019-04-01 Mao Han <han_mao@c-sky.com>
+
+ * elf.h: Update from glibc.
+
2019-03-07 Mark Wielaard <mark@klomp.org>
* elf32_updatefile.c (updatemmap): Use posix_memalign instead of
diff --git a/libelf/elf.h b/libelf/elf.h
index 75043bc..01648bd 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2018 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -360,8 +360,9 @@ typedef struct
#define EM_RISCV 243 /* RISC-V */
#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
+#define EM_CSKY 252 /* C-SKY */
-#define EM_NUM 248
+#define EM_NUM 253
/* Old spellings/synonyms. */
@@ -808,6 +809,9 @@ typedef struct
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
registers */
+#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
+#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
+#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
/* Legal values for the note segment descriptor types for object files. */
@@ -1214,6 +1218,9 @@ typedef struct
#define AT_L3_CACHESIZE 46
#define AT_L3_CACHEGEOMETRY 47
+#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery
+ (AArch64). */
+
/* Note section contents. Each entry in the note section begins with
a header of a fixed form. */
@@ -3015,6 +3022,81 @@ enum
/* Keep this the last entry. */
#define R_ARM_NUM 256
+/* C-SKY */
+#define R_CKCORE_NONE 0 /* no reloc */
+#define R_CKCORE_ADDR32 1 /* direct 32 bit (S + A) */
+#define R_CKCORE_PCRELIMM8BY4 2 /* disp ((S + A - P) >> 2) & 0xff */
+#define R_CKCORE_PCRELIMM11BY2 3 /* disp ((S + A - P) >> 1) & 0x7ff */
+#define R_CKCORE_PCREL32 5 /* 32-bit rel (S + A - P) */
+#define R_CKCORE_PCRELJSR_IMM11BY2 6 /* disp ((S + A - P) >>1) & 0x7ff */
+#define R_CKCORE_RELATIVE 9 /* 32 bit adjust program base(B + A)*/
+#define R_CKCORE_COPY 10 /* 32 bit adjust by program base */
+#define R_CKCORE_GLOB_DAT 11 /* off between got and sym (S) */
+#define R_CKCORE_JUMP_SLOT 12 /* PLT entry (S) */
+#define R_CKCORE_GOTOFF 13 /* offset to GOT (S + A - GOT) */
+#define R_CKCORE_GOTPC 14 /* PC offset to GOT (GOT + A - P) */
+#define R_CKCORE_GOT32 15 /* 32 bit GOT entry (G) */
+#define R_CKCORE_PLT32 16 /* 32 bit PLT entry (G) */
+#define R_CKCORE_ADDRGOT 17 /* GOT entry in GLOB_DAT (GOT + G) */
+#define R_CKCORE_ADDRPLT 18 /* PLT entry in GLOB_DAT (GOT + G) */
+#define R_CKCORE_PCREL_IMM26BY2 19 /* ((S + A - P) >> 1) & 0x3ffffff */
+#define R_CKCORE_PCREL_IMM16BY2 20 /* disp ((S + A - P) >> 1) & 0xffff */
+#define R_CKCORE_PCREL_IMM16BY4 21 /* disp ((S + A - P) >> 2) & 0xffff */
+#define R_CKCORE_PCREL_IMM10BY2 22 /* disp ((S + A - P) >> 1) & 0x3ff */
+#define R_CKCORE_PCREL_IMM10BY4 23 /* disp ((S + A - P) >> 2) & 0x3ff */
+#define R_CKCORE_ADDR_HI16 24 /* high & low 16 bit ADDR */
+ /* ((S + A) >> 16) & 0xffff */
+#define R_CKCORE_ADDR_LO16 25 /* (S + A) & 0xffff */
+#define R_CKCORE_GOTPC_HI16 26 /* high & low 16 bit GOTPC */
+ /* ((GOT + A - P) >> 16) & 0xffff */
+#define R_CKCORE_GOTPC_LO16 27 /* (GOT + A - P) & 0xffff */
+#define R_CKCORE_GOTOFF_HI16 28 /* high & low 16 bit GOTOFF */
+ /* ((S + A - GOT) >> 16) & 0xffff */
+#define R_CKCORE_GOTOFF_LO16 29 /* (S + A - GOT) & 0xffff */
+#define R_CKCORE_GOT12 30 /* 12 bit disp GOT entry (G) */
+#define R_CKCORE_GOT_HI16 31 /* high & low 16 bit GOT */
+ /* (G >> 16) & 0xffff */
+#define R_CKCORE_GOT_LO16 32 /* (G & 0xffff) */
+#define R_CKCORE_PLT12 33 /* 12 bit disp PLT entry (G) */
+#define R_CKCORE_PLT_HI16 34 /* high & low 16 bit PLT */
+ /* (G >> 16) & 0xffff */
+#define R_CKCORE_PLT_LO16 35 /* G & 0xffff */
+#define R_CKCORE_ADDRGOT_HI16 36 /* high & low 16 bit ADDRGOT */
+ /* (GOT + G * 4) & 0xffff */
+#define R_CKCORE_ADDRGOT_LO16 37 /* (GOT + G * 4) & 0xffff */
+#define R_CKCORE_ADDRPLT_HI16 38 /* high & low 16 bit ADDRPLT */
+ /* ((GOT + G * 4) >> 16) & 0xFFFF */
+#define R_CKCORE_ADDRPLT_LO16 39 /* (GOT+G*4) & 0xffff */
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40 /* disp ((S+A-P) >>1) & x3ffffff */
+#define R_CKCORE_TOFFSET_LO16 41 /* (S+A-BTEXT) & 0xffff */
+#define R_CKCORE_DOFFSET_LO16 42 /* (S+A-BTEXT) & 0xffff */
+#define R_CKCORE_PCREL_IMM18BY2 43 /* disp ((S+A-P) >>1) & 0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18 44 /* disp (S+A-BDATA) & 0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18BY2 45 /* disp ((S+A-BDATA)>>1) & 0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18BY4 46 /* disp ((S+A-BDATA)>>2) & 0x3ffff */
+#define R_CKCORE_GOT_IMM18BY4 48 /* disp (G >> 2) */
+#define R_CKCORE_PLT_IMM18BY4 49 /* disp (G >> 2) */
+#define R_CKCORE_PCREL_IMM7BY4 50 /* disp ((S+A-P) >>2) & 0x7f */
+#define R_CKCORE_TLS_LE32 51 /* 32 bit offset to TLS block */
+#define R_CKCORE_TLS_IE32 52
+#define R_CKCORE_TLS_GD32 53
+#define R_CKCORE_TLS_LDM32 54
+#define R_CKCORE_TLS_LDO32 55
+#define R_CKCORE_TLS_DTPMOD32 56
+#define R_CKCORE_TLS_DTPOFF32 57
+#define R_CKCORE_TLS_TPOFF32 58
+
+/* C-SKY elf header definition. */
+#define EF_CSKY_ABIMASK 0XF0000000
+#define EF_CSKY_OTHER 0X0FFF0000
+#define EF_CSKY_PROCESSOR 0X0000FFFF
+
+#define EF_CSKY_ABIV1 0X10000000
+#define EF_CSKY_ABIV2 0X20000000
+
+/* C-SKY attributes section. */
+#define SHT_CSKY_ATTRIBUTES (SHT_LOPROC + 1)
+
/* IA-64 specific declarations. */
/* Processor specific flags for the Ehdr e_flags field. */
@@ -3915,6 +3997,16 @@ enum
#define R_METAG_TLS_LE_HI16 60
#define R_METAG_TLS_LE_LO16 61
+/* NDS32 relocations. */
+#define R_NDS32_NONE 0
+#define R_NDS32_32_RELA 20
+#define R_NDS32_COPY 39
+#define R_NDS32_GLOB_DAT 40
+#define R_NDS32_JMP_SLOT 41
+#define R_NDS32_RELATIVE 42
+#define R_NDS32_TLS_TPOFF 102
+#define R_NDS32_TLS_DESC 119
+
__END_DECLS
#endif /* elf.h */
--
2.7.4
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/2] Add C-SKY support
2019-04-01 2:33 [PATCH 0/2] Add C-SKY support Mao Han
2019-04-01 2:33 ` [PATCH 2/2] Add backend support for C-SKY Mao Han
2019-04-01 2:33 ` [PATCH 1/2] libelf: Sync elf.h from glibc Mao Han
@ 2019-04-03 20:54 ` Mark Wielaard
2019-04-04 6:19 ` Mao Han
2 siblings, 1 reply; 16+ messages in thread
From: Mark Wielaard @ 2019-04-03 20:54 UTC (permalink / raw)
To: Mao Han; +Cc: elfutils-devel, ren_guo
Hi,
On Mon, Apr 01, 2019 at 10:31:55AM +0800, Mao Han wrote:
> This patch add backend support for C-SKY architecture.
Thanks. I don't know anything about the C-SKY architecture. Do you
have an URL to the ELF/DWARF supplemental spec that describes the ELF
structures and DWARF register numbers C-SKY uses? It would be good to
have that in the commit message and/or in a comment in the backend.
In general please read the CONTRIBUTING file and add a Signed-off-by
line if you agree with and can contribute the patch under the
appropriate licenses. Please also add a copyright line to the new
files.
> Tested on X86 and got no regression.
> Also tested on C-SKY qemu. I didn't find any easy way to do the cross test,
> so I modified the test script to run the test suite with ssh, some testcases
> fail due to the script modification.
Does qemu support full system or user-mode only C-SKY?
> FAIL: run-exprlocs-self.sh
> ==========================
>
> /home/vmh/elfutilswk/tests/varlocs: dwarf_getlocation_attr for addr: .debug_addr section missing
> *** failure in /home/vmh/elfutilswk/tests/varlocs --exprlocs -e /home/vmh/elfutilswk/src/readelf
> FAIL run-exprlocs-self.sh (exit status: 1)
This is somewhat surprising. Do you build with -gdwarf-5? If you
could make the /home/vmh/elfutilswk/src/readelf binary available
somewhere we could investigate what goes on.
> FAIL: run-native-test.sh
> ========================
>
> allregs: 23064: No such file or directory
> FAIL run-native-test.sh (exit status: 1)
This is probably because of the script modifications. The test cannot
find the running process.
> FAIL: run-dwarf-getmacros.sh
> ============================
>
> --- dwarf-getmacros.out 2019-02-19 19:28:29.405840052 +0800
> +++ /tmp/123 2019-02-19 19:28:27.789032052 +0800
> @@ -1 +1,4 @@
> -invalid opcode
> +opcode 255 with 0 arguments
> +file /home/petr/proj/elfutils/master/elfutils/x.c
> + FOO 0
> +/file
> FAIL run-dwarf-getmacros.sh (exit status: 1)
This is again surprising. I think something went wrong invoking the
test. If you look at tests/run-dwarf-getmacros.sh you'll see that it
runs the last testcase twice. Once with 2 and once with 3
arguments. The third argument is the empty string (but could really be
anything). Maybe the empty string was lost somehow?
> SKIP: run-backtrace-data.sh
> ===========================
>
> /home/vmh/elfutilswk/tests/backtrace-data: x86_64 linux only test
> SKIP run-backtrace-data.sh (exit status: 77)
>
> SKIP: run-backtrace-native-biarch.sh
> ====================================
>
> biarch testing disabled
> SKIP run-backtrace-native-biarch.sh (exit status: 77)
>
> SKIP: run-backtrace-native-core.sh
> ==================================
>
> Aborted
> No core.12362 file generated
> SKIP run-backtrace-native-core.sh (exit status: 77)
>
> SKIP: run-backtrace-native-core-biarch.sh
> =========================================
>
> biarch testing disabled
> SKIP run-backtrace-native-core-biarch.sh (exit status: 77)
I haven't looked at the code yet, so maybe none of the backtrace tests
would work even if you could run in "full system mode". If you do have
a way to generate a C-SKY core file it would be interesting to see if
you can get a backtrace from it using eu-stack.
> FAIL: run-deleted.sh
> ====================
>
> PID 12587 - process
> TID 12587:
> #0 0x2ab79648 sleep
> #1 0x2ab79648 sleep
> #2 0x2aace6a4
> /home/vmh/elfutilswk/src/stack: dwfl_thread_getframes tid 12587 at 0x2aace6a3 in /home/vmh/elfutilswk/tests/test-25076/deleted-lib.so: Callback returned failure
> ./run-deleted.sh: line 38: kill: (12587) - No such process
> FAIL run-deleted.sh (exit status: 1)
This is again most likely because of script changes.
The test cannot find the running process.
Cheers,
Mark
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/2] Add C-SKY support
2019-04-03 20:54 ` [PATCH 0/2] Add C-SKY support Mark Wielaard
@ 2019-04-04 6:19 ` Mao Han
2019-04-04 6:27 ` Mao Han
0 siblings, 1 reply; 16+ messages in thread
From: Mao Han @ 2019-04-04 6:19 UTC (permalink / raw)
To: Mark Wielaard; +Cc: ren_guo, elfutils-devel
Hi,
On Wed, Apr 03, 2019 at 10:54:11PM +0200, Mark Wielaard wrote:
> Hi,
>
> On Mon, Apr 01, 2019 at 10:31:55AM +0800, Mao Han wrote:
> > This patch add backend support for C-SKY architecture.
>
> Thanks. I don't know anything about the C-SKY architecture. Do you
> have an URL to the ELF/DWARF supplemental spec that describes the ELF
> structures and DWARF register numbers C-SKY uses? It would be good to
> have that in the commit message and/or in a comment in the backend.
ELF structures can be found inside the ABI manual.
CSKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_I
+nterface_Standards_Manual.pdf
CSKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.p
+df
The DWARF part of the document is out of date. GCC source code can
be used as reference:
const int csky_dbx_regno[FIRST_PSEUDO_REGISTER] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
-1, -1, 36, 37, 35, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, -1, -1, 72
};
The number in the array is the DWARF register numbers, the corresponding
register can be found in the corresponding below.
#define FIXED_REGISTERS \
/* r0 r1 r2 r3 r4 r5 r6 r7 */ \
{ 0, 0, 0, 0, 0, 0, 0, 0, \
/* r8 r9 r10 r11 r12 r13 r14 r15 */ \
0, 0, 0, 0, 0, 0, 1, 0, \
/* r16 r17 r18 r19 r20 r21 r22 r23 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* r24 r25 r26 r27 r28 r29 r30 tls */ \
0, 0, 1, 1, 1, 1, 1, 1, \
/* reserve c hi lo */ \
1, 1, 0, 0, \
/* reserved */ \
1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
0, 0, 0, 0, 0, 0, 0, 0 , \
/* reserved */ \
1, 1, \
/* epc */ \
1 \
}
These code come from gcc/config/csky/csky.c and gcc/config/csky/csky.h:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/csky/csky.c;h=e4ac93323c0
+287d8d3d8191d51260983490fcac1;hb=73c7feb34d49e52ca5b6c2342cda882a9b06a036
> In general please read the CONTRIBUTING file and add a Signed-off-by
> line if you agree with and can contribute the patch under the
> appropriate licenses. Please also add a copyright line to the new
> files.
>
Ok, I'll add the Signed-off-by line and the copyright.
> Does qemu support full system or user-mode only C-SKY?
>
Yes, we have support for both system-mode and user-mode.
Our linux system is available at:
https://gitlab.com/c-sky/buildroot
Our linux ci enviroment:
https://gitlab.com/c-sky/buildroot/-/jobs/187862406
> > FAIL: run-exprlocs-self.sh
> > ==========================
> >
> > /home/vmh/elfutilswk/tests/varlocs: dwarf_getlocation_attr for addr: +.debug_addr section missing
> > *** failure in /home/vmh/elfutilswk/tests/varlocs --exprlocs -e +/home/vmh/elfutilswk/src/readelf
> > FAIL run-exprlocs-self.sh (exit status: 1)
>
> This is somewhat surprising. Do you build with -gdwarf-5? If you
> could make the /home/vmh/elfutilswk/src/readelf binary available
> somewhere we could investigate what goes on.
>
The default compile option is dwarf 4. I'v upload the binary to
https://github.com/c-sky/test-result/blob/master/elfutils/readelf
As I used the non-upstream version gcc to do the test, the machine
code is 39(EM_RCE) not 252(EM_CSKY).
> >
> > biarch testing disabled
> > SKIP run-backtrace-native-core-biarch.sh (exit status: 77)
>
> I haven't looked at the code yet, so maybe none of the backtrace tests
> would work even if you could run in "full system mode". If you do have
> a way to generate a C-SKY core file it would be interesting to see if
> you can get a backtrace from it using eu-stack.
>
Ok, I'll try if I can get a backtrace with C-SKY core file.
Thanks,
Mao Han
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/2] Add C-SKY support
2019-04-04 6:19 ` Mao Han
@ 2019-04-04 6:27 ` Mao Han
0 siblings, 0 replies; 16+ messages in thread
From: Mao Han @ 2019-04-04 6:27 UTC (permalink / raw)
To: Mark Wielaard; +Cc: elfutils-devel, ren_guo
Hi,
FIX NEWLINE IN LAST EMAIL
On Wed, Apr 03, 2019 at 10:54:11PM +0200, Mark Wielaard wrote:
> Hi,
>
> On Mon, Apr 01, 2019 at 10:31:55AM +0800, Mao Han wrote:
> > This patch add backend support for C-SKY architecture.
>
> Thanks. I don't know anything about the C-SKY architecture. Do you
> have an URL to the ELF/DWARF supplemental spec that describes the ELF
> structures and DWARF register numbers C-SKY uses? It would be good to
> have that in the commit message and/or in a comment in the backend.
ELF structures can be found inside the ABI manual.
CSKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
CSKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf
The DWARF part of the document is out of date. GCC source code can
be used as reference:
const int csky_dbx_regno[FIRST_PSEUDO_REGISTER] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
-1, -1, 36, 37, 35, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, -1, -1, 72
};
The number in the array is the DWARF register numbers, the corresponding
register can be found in the corresponding below.
#define FIXED_REGISTERS \
/* r0 r1 r2 r3 r4 r5 r6 r7 */ \
{ 0, 0, 0, 0, 0, 0, 0, 0, \
/* r8 r9 r10 r11 r12 r13 r14 r15 */ \
0, 0, 0, 0, 0, 0, 1, 0, \
/* r16 r17 r18 r19 r20 r21 r22 r23 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* r24 r25 r26 r27 r28 r29 r30 tls */ \
0, 0, 1, 1, 1, 1, 1, 1, \
/* reserve c hi lo */ \
1, 1, 0, 0, \
/* reserved */ \
1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
0, 0, 0, 0, 0, 0, 0, 0 , \
/* reserved */ \
1, 1, \
/* epc */ \
1 \
}
These code come from gcc/config/csky/csky.c and gcc/config/csky/csky.h:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/csky/csky.c;h=e4ac93323c0287d8d3d8191d51260983490fcac1;hb=73c7feb34d49e52ca5b6c2342cda882a9b06a036
> In general please read the CONTRIBUTING file and add a Signed-off-by
> line if you agree with and can contribute the patch under the
> appropriate licenses. Please also add a copyright line to the new
> files.
>
Ok, I'll add the Signed-off-by line and the copyright.
> Does qemu support full system or user-mode only C-SKY?
>
Yes, we have support for both system-mode and user-mode.
Our linux system is available at:
https://gitlab.com/c-sky/buildroot
Our linux ci enviroment:
https://gitlab.com/c-sky/buildroot/-/jobs/187862406
> > FAIL: run-exprlocs-self.sh
> > ==========================
> >
> > /home/vmh/elfutilswk/tests/varlocs: dwarf_getlocation_attr for addr: .debug_addr section missing
> > *** failure in /home/vmh/elfutilswk/tests/varlocs --exprlocs -e /home/vmh/elfutilswk/src/readelf
> > FAIL run-exprlocs-self.sh (exit status: 1)
>
> This is somewhat surprising. Do you build with -gdwarf-5? If you
> could make the /home/vmh/elfutilswk/src/readelf binary available
> somewhere we could investigate what goes on.
>
The default compile option is dwarf 4. I'v upload the binary to
https://github.com/c-sky/test-result/blob/master/elfutils/readelf
As I used the non-upstream version gcc to do the test, the machine
code is 39(EM_RCE) not 252(EM_CSKY).
> >
> > biarch testing disabled
> > SKIP run-backtrace-native-core-biarch.sh (exit status: 77)
>
> I haven't looked at the code yet, so maybe none of the backtrace tests
> would work even if you could run in "full system mode". If you do have
> a way to generate a C-SKY core file it would be interesting to see if
> you can get a backtrace from it using eu-stack.
>
Ok, I'll try if I can get a backtrace with C-SKY core file.
Thanks,
Mao Han
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from glibc
2024-02-23 4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
@ 2024-02-23 4:47 ` Xi Ruoyao
0 siblings, 0 replies; 16+ messages in thread
From: Xi Ruoyao @ 2024-02-23 4:47 UTC (permalink / raw)
To: elfutils-devel
Cc: Mark Wielaard, WANG Xuerui, Jinyang He, Youling Tang, Xi Ruoyao
Adds new LoongArch relocations.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
libelf/elf.h | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/libelf/elf.h b/libelf/elf.h
index 7b4a8fe4..f2206e5c 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2023 Free Software Foundation, Inc.
+ Copyright (C) 1995-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -791,9 +791,12 @@ typedef struct
Register */
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys
registers. */
+#define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers. */
+#define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register. */
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
+#define NT_X86_SHSTK 0x204 /* x86 SHSTK state */
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
#define NT_S390_TIMER 0x301 /* s390 timer register */
#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
@@ -832,6 +835,8 @@ typedef struct
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
+#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
+#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and
status registers. */
@@ -841,6 +846,8 @@ typedef struct
SIMD Extension registers. */
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary
Translation registers. */
+#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
+#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
/* Legal values for the note segment descriptor types for object files. */
@@ -3632,6 +3639,11 @@ enum
/* x86-64 sh_type values. */
#define SHT_X86_64_UNWIND 0x70000001 /* Unwind information. */
+/* x86-64 d_tag values. */
+#define DT_X86_64_PLT (DT_LOPROC + 0)
+#define DT_X86_64_PLTSZ (DT_LOPROC + 1)
+#define DT_X86_64_PLTENT (DT_LOPROC + 3)
+#define DT_X86_64_NUM 4
/* AM33 relocations. */
#define R_MN10300_NONE 0 /* No reloc. */
@@ -4319,6 +4331,23 @@ enum
#define R_LARCH_ADD_ULEB128 107
#define R_LARCH_SUB_ULEB128 108
#define R_LARCH_64_PCREL 109
+#define R_LARCH_CALL36 110
+#define R_LARCH_TLS_DESC_PC_HI20 111
+#define R_LARCH_TLS_DESC_PC_LO12 112
+#define R_LARCH_TLS_DESC64_PC_LO20 113
+#define R_LARCH_TLS_DESC64_PC_HI12 114
+#define R_LARCH_TLS_DESC_HI20 115
+#define R_LARCH_TLS_DESC_LO12 116
+#define R_LARCH_TLS_DESC64_LO20 117
+#define R_LARCH_TLS_DESC64_HI12 118
+#define R_LARCH_TLS_DESC_LD 119
+#define R_LARCH_TLS_DESC_CALL 120
+#define R_LARCH_TLS_LE_HI20_R 121
+#define R_LARCH_TLS_LE_ADD_R 122
+#define R_LARCH_TLS_LE_LO12_R 123
+#define R_LARCH_TLS_LD_PCREL20_S2 124
+#define R_LARCH_TLS_GD_PCREL20_S2 125
+#define R_LARCH_TLS_DESC_PCREL20_S2 126
/* ARC specific declarations. */
--
2.43.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] libelf: Sync elf.h from Glibc
2023-08-29 13:14 [PATCH 1/2] libelf: Sync elf.h from Glibc Xi Ruoyao
@ 2023-08-29 13:23 ` Mark Wielaard
0 siblings, 0 replies; 16+ messages in thread
From: Mark Wielaard @ 2023-08-29 13:23 UTC (permalink / raw)
To: Xi Ruoyao, elfutils-devel; +Cc: Youling Tang
On Tue, 2023-08-29 at 21:14 +0800, Xi Ruoyao via Elfutils-devel wrote:
> Adds new LoongArch relocations.
>
> * elf.h: Update from glibc.
Thanks, matches current glibc elf/elf.h.
Pushed,
Mark
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from Glibc
@ 2023-08-29 13:14 Xi Ruoyao
2023-08-29 13:23 ` Mark Wielaard
0 siblings, 1 reply; 16+ messages in thread
From: Xi Ruoyao @ 2023-08-29 13:14 UTC (permalink / raw)
To: elfutils-devel; +Cc: Youling Tang, Mark Wielaard, Xi Ruoyao
Adds new LoongArch relocations.
* elf.h: Update from glibc.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
libelf/elf.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libelf/elf.h b/libelf/elf.h
index 89fc8021..9c51073f 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -4205,6 +4205,15 @@ enum
#define R_LARCH_TLS_GD_HI20 98
#define R_LARCH_32_PCREL 99
#define R_LARCH_RELAX 100
+#define R_LARCH_DELETE 101
+#define R_LARCH_ALIGN 102
+#define R_LARCH_PCREL20_S2 103
+#define R_LARCH_CFA 104
+#define R_LARCH_ADD6 105
+#define R_LARCH_SUB6 106
+#define R_LARCH_ADD_ULEB128 107
+#define R_LARCH_SUB_ULEB128 108
+#define R_LARCH_64_PCREL 109
/* ARC specific declarations. */
--
2.42.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] libelf: Sync elf.h from glibc.
2023-04-01 6:43 Youling Tang
@ 2023-04-06 22:23 ` Mark Wielaard
0 siblings, 0 replies; 16+ messages in thread
From: Mark Wielaard @ 2023-04-06 22:23 UTC (permalink / raw)
To: Youling Tang; +Cc: elfutils-devel
On Sat, Apr 01, 2023 at 02:43:43PM +0800, Youling Tang wrote:
> Adds R_LARCH_*.
Thanks, pushed.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from glibc.
@ 2023-04-01 6:43 Youling Tang
2023-04-06 22:23 ` Mark Wielaard
0 siblings, 1 reply; 16+ messages in thread
From: Youling Tang @ 2023-04-01 6:43 UTC (permalink / raw)
To: elfutils-devel
Adds R_LARCH_*.
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
libelf/ChangeLog | 4 ++++
libelf/elf.h | 42 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 8cc3c53c..1d5178ca 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2023-04-01 Youling Tang <tangyouling@loongson.cn>
+
+ * elf.h: Update from glibc.
+
2023-03-03 Mark Wielaard <mark@klomp.org>
* libelf.h: Define ELFCOMPRESS_ZSTD if undefined.
diff --git a/libelf/elf.h b/libelf/elf.h
index da41bad3..4bc0e429 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2022 Free Software Foundation, Inc.
+ Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -4159,6 +4159,46 @@ enum
#define R_LARCH_GNU_VTINHERIT 57
#define R_LARCH_GNU_VTENTRY 58
+/* reserved 59-63 */
+
+#define R_LARCH_B16 64
+#define R_LARCH_B21 65
+#define R_LARCH_B26 66
+#define R_LARCH_ABS_HI20 67
+#define R_LARCH_ABS_LO12 68
+#define R_LARCH_ABS64_LO20 69
+#define R_LARCH_ABS64_HI12 70
+#define R_LARCH_PCALA_HI20 71
+#define R_LARCH_PCALA_LO12 72
+#define R_LARCH_PCALA64_LO20 73
+#define R_LARCH_PCALA64_HI12 74
+#define R_LARCH_GOT_PC_HI20 75
+#define R_LARCH_GOT_PC_LO12 76
+#define R_LARCH_GOT64_PC_LO20 77
+#define R_LARCH_GOT64_PC_HI12 78
+#define R_LARCH_GOT_HI20 79
+#define R_LARCH_GOT_LO12 80
+#define R_LARCH_GOT64_LO20 81
+#define R_LARCH_GOT64_HI12 82
+#define R_LARCH_TLS_LE_HI20 83
+#define R_LARCH_TLS_LE_LO12 84
+#define R_LARCH_TLS_LE64_LO20 85
+#define R_LARCH_TLS_LE64_HI12 86
+#define R_LARCH_TLS_IE_PC_HI20 87
+#define R_LARCH_TLS_IE_PC_LO12 88
+#define R_LARCH_TLS_IE64_PC_LO20 89
+#define R_LARCH_TLS_IE64_PC_HI12 90
+#define R_LARCH_TLS_IE_HI20 91
+#define R_LARCH_TLS_IE_LO12 92
+#define R_LARCH_TLS_IE64_LO20 93
+#define R_LARCH_TLS_IE64_HI12 94
+#define R_LARCH_TLS_LD_PC_HI20 95
+#define R_LARCH_TLS_LD_HI20 96
+#define R_LARCH_TLS_GD_PC_HI20 97
+#define R_LARCH_TLS_GD_HI20 98
+#define R_LARCH_32_PCREL 99
+#define R_LARCH_RELAX 100
+
/* ARC specific declarations. */
/* Processor specific flags for the Ehdr e_flags field. */
--
2.37.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] libelf: Sync elf.h from glibc.
2020-12-16 10:44 ` Dmitry V. Levin
@ 2020-12-16 18:52 ` Mark Wielaard
0 siblings, 0 replies; 16+ messages in thread
From: Mark Wielaard @ 2020-12-16 18:52 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: elfutils-devel
On Wed, Dec 16, 2020 at 01:44:44PM +0300, Dmitry V. Levin wrote:
> On Sat, Dec 12, 2020 at 11:38:54PM +0100, Mark Wielaard wrote:
> > Adds SHF_GNU_RETAIN.
>
> This is obviously OK.
Thanks, pushed.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] libelf: Sync elf.h from glibc.
2020-12-12 22:38 Mark Wielaard
@ 2020-12-16 10:44 ` Dmitry V. Levin
2020-12-16 18:52 ` Mark Wielaard
0 siblings, 1 reply; 16+ messages in thread
From: Dmitry V. Levin @ 2020-12-16 10:44 UTC (permalink / raw)
To: elfutils-devel
On Sat, Dec 12, 2020 at 11:38:54PM +0100, Mark Wielaard wrote:
> Adds SHF_GNU_RETAIN.
This is obviously OK.
--
ldv
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from glibc.
@ 2020-12-12 22:38 Mark Wielaard
2020-12-16 10:44 ` Dmitry V. Levin
0 siblings, 1 reply; 16+ messages in thread
From: Mark Wielaard @ 2020-12-12 22:38 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
Adds SHF_GNU_RETAIN.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libelf/ChangeLog | 4 ++++
libelf/elf.h | 13 +++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 41727fbd..2d8bbe5d 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2020-12-12 Mark Wielaard <mark@klomp.org>
+
+ * elf.h: Update from glibc.
+
2020-12-12 Dmitry V. Levin <ldv@altlinux.org>
* common.h: Fix spelling typo in comment.
diff --git a/libelf/elf.h b/libelf/elf.h
index 6439c1a4..8e3e618f 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -318,7 +318,7 @@ typedef struct
/* reserved 184 */
#define EM_AVR32 185 /* Amtel 32-bit microprocessor */
#define EM_STM8 186 /* STMicroelectronics STM8 */
-#define EM_TILE64 187 /* Tileta TILE64 */
+#define EM_TILE64 187 /* Tilera TILE64 */
#define EM_TILEPRO 188 /* Tilera TILEPro */
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
#define EM_CUDA 190 /* NVIDIA CUDA */
@@ -441,7 +441,7 @@ typedef struct
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
-#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
+#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
#define SHT_NUM 19 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific. */
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
@@ -478,6 +478,7 @@ typedef struct
#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
+#define SHF_GNU_RETAIN (1 << 21) /* Not to be GCed by linker. */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
(Solaris). */
#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
@@ -1046,7 +1047,7 @@ typedef struct
#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
-/* Auxialiary version information. */
+/* Auxiliary version information. */
typedef struct
{
@@ -2139,9 +2140,9 @@ enum
#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
-/* Additional section indeces. */
+/* Additional section indices. */
-#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared
symbols in ANSI C. */
#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
@@ -3970,7 +3971,7 @@ enum
#define R_METAG_RELBRANCH 4
#define R_METAG_GETSETOFF 5
-/* Backward compatability */
+/* Backward compatibility */
#define R_METAG_REG32OP1 6
#define R_METAG_REG32OP2 7
#define R_METAG_REG32OP3 8
--
2.20.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] libelf: Sync elf.h from glibc.
2020-08-28 22:42 [PATCH 1/2] libelf: Sync elf.h from glibc Mark Wielaard
@ 2020-09-07 7:29 ` Mark Wielaard
0 siblings, 0 replies; 16+ messages in thread
From: Mark Wielaard @ 2020-09-07 7:29 UTC (permalink / raw)
To: elfutils-devel
On Sat, 2020-08-29 at 00:42 +0200, Mark Wielaard wrote:
> Gets us DT_AARCH64_BTI_PLT and DT_AARCH64_PAC_PLT.
Pushed.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] libelf: Sync elf.h from glibc.
@ 2020-08-28 22:42 Mark Wielaard
2020-09-07 7:29 ` Mark Wielaard
0 siblings, 1 reply; 16+ messages in thread
From: Mark Wielaard @ 2020-08-28 22:42 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
Gets us DT_AARCH64_BTI_PLT and DT_AARCH64_PAC_PLT.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libelf/ChangeLog | 4 ++++
libelf/elf.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 77044c1c..a3f15883 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-28 Mark Wielaard <mark@klomp.org>
+
+ * elf.h: Update from glibc.
+
2020-08-19 Mark Wielaard <mark@klomp.org>
* elf32_updatenull.c (updatenull_wrlock): Fixup the sh_addralign
diff --git a/libelf/elf.h b/libelf/elf.h
index 197b557d..ff9f1dad 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -2875,6 +2875,8 @@ enum
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* AArch64 specific values for the Dyn d_tag field. */
+#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
+#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
#define DT_AARCH64_NUM 6
--
2.18.4
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-02-23 4:47 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 2:33 [PATCH 0/2] Add C-SKY support Mao Han
2019-04-01 2:33 ` [PATCH 2/2] Add backend support for C-SKY Mao Han
2019-04-01 2:33 ` [PATCH 1/2] libelf: Sync elf.h from glibc Mao Han
2019-04-03 20:54 ` [PATCH 0/2] Add C-SKY support Mark Wielaard
2019-04-04 6:19 ` Mao Han
2019-04-04 6:27 ` Mao Han
2020-08-28 22:42 [PATCH 1/2] libelf: Sync elf.h from glibc Mark Wielaard
2020-09-07 7:29 ` Mark Wielaard
2020-12-12 22:38 Mark Wielaard
2020-12-16 10:44 ` Dmitry V. Levin
2020-12-16 18:52 ` Mark Wielaard
2023-04-01 6:43 Youling Tang
2023-04-06 22:23 ` Mark Wielaard
2023-08-29 13:14 [PATCH 1/2] libelf: Sync elf.h from Glibc Xi Ruoyao
2023-08-29 13:23 ` Mark Wielaard
2024-02-23 4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
2024-02-23 4:47 ` [PATCH 1/2] libelf: Sync elf.h from glibc Xi Ruoyao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).