tools/elfutils: update to 0.192
Update to the next release. Removed upstream patch: - 000-backport-iquote-include.patch - 010-backport-mips-support-reloc.patch - 014-backport-mips-support-stack.patch - 015-backport-mips-support-regs.patch - 095-src-unused-variable.patch - 096-lib-config_h.patch - 097-libcpu-config_h.patch - 098-libdw-maintainer-clean.patch - 099-remove-unlocked-stdio.patch Manually adjusted patch: - 012-backport-mips-support-readelf.patch - 013-backport-mips-support-elflint.patch - 101-shared-conditional.patch All other patches are automatically refreshed. Link: https://sourceware.org/pipermail/elfutils-devel/2024q4/007540.html Tested-by: Georgi Valkov <gvalkov@gmail.com> # macOS Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/16522 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
5bb84fb53b
commit
abf243eae8
|
@ -3,12 +3,12 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=elfutils
|
||||
PKG_VERSION:=0.191
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=0.192
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
|
||||
PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871
|
||||
PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
From b426c4db31e7c80d4262abdd845d2ece0c9a841c Mon Sep 17 00:00:00 2001
|
||||
From: Alfred Wingate <parona@protonmail.com>
|
||||
Date: Wed, 14 Aug 2024 12:14:38 -0400
|
||||
Subject: [PATCH] Avoid overriding libcxx system header
|
||||
|
||||
Replace -I with -iquote to avoid overriding stack system header from libcxx-18
|
||||
with the previously built stack binary. Override DEFAULT_INLCUDES because m4
|
||||
adds -I. by default.
|
||||
|
||||
Signed-off-by: Aaron Merey <amerey@redhat.com>
|
||||
---
|
||||
config/eu.am | 2 +-
|
||||
src/Makefile.am | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/config/eu.am
|
||||
+++ b/config/eu.am
|
||||
@@ -31,7 +31,7 @@
|
||||
##
|
||||
|
||||
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
|
||||
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
|
||||
+AM_CPPFLAGS = -iquote . -I$(srcdir) -I$(top_srcdir)/lib -I..
|
||||
|
||||
# Drop the 'u' flag that automake adds by default. It is incompatible
|
||||
# with deterministic archives.
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -19,6 +19,8 @@
|
||||
include $(top_srcdir)/config/eu.am
|
||||
DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \
|
||||
-DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
|
||||
+
|
||||
+DEFAULT_INCLUDES =
|
||||
AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
|
||||
-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
|
||||
-I$(srcdir)/../libdwfl -I$(srcdir)/../libasm -I../debuginfod
|
|
@ -1,300 +0,0 @@
|
|||
From e259f126f5077923e415e306915de50ed0f0db56 Mon Sep 17 00:00:00 2001
|
||||
From: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
Date: Tue, 5 Mar 2024 17:51:17 +0800
|
||||
Subject: [PATCH] Support Mips architecture
|
||||
|
||||
* backends/Makefile.am (modules): Add mips.
|
||||
(mips_SRCS): New var for mips_init.c mips_symbol.c.
|
||||
(libebl_backends_a_SOURCES): Add mips_SRCS.
|
||||
* backends/mips_init.c: New file.
|
||||
* backends/mips_reloc.def: Likewise.
|
||||
* backends/mips_symbol.c: Likewise.
|
||||
* libebl/eblopenbackend.c (mips_init): Declare.
|
||||
(machines): Add mips.
|
||||
* libelf/libelfP.h: Add ELF64_MIPS_R_TYPE{1,2,3}
|
||||
|
||||
Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
---
|
||||
backends/Makefile.am | 6 ++-
|
||||
backends/mips_init.c | 52 +++++++++++++++++++++++
|
||||
backends/mips_reloc.def | 93 +++++++++++++++++++++++++++++++++++++++++
|
||||
backends/mips_symbol.c | 63 ++++++++++++++++++++++++++++
|
||||
libebl/eblopenbackend.c | 2 +
|
||||
libelf/libelfP.h | 3 ++
|
||||
6 files changed, 217 insertions(+), 2 deletions(-)
|
||||
create mode 100644 backends/mips_init.c
|
||||
create mode 100644 backends/mips_reloc.def
|
||||
create mode 100644 backends/mips_symbol.c
|
||||
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -37,7 +37,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
|
||||
noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
|
||||
|
||||
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
|
||||
- m68k bpf riscv csky loongarch arc
|
||||
+ m68k bpf riscv csky loongarch arc mips
|
||||
|
||||
i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \
|
||||
i386_retval.c i386_regs.c i386_auxv.c \
|
||||
@@ -102,12 +102,14 @@ loongarch_SRCS = loongarch_init.c loonga
|
||||
|
||||
arc_SRCS = arc_init.c arc_symbol.c
|
||||
|
||||
+mips_SRCS = mips_init.c mips_symbol.c
|
||||
+
|
||||
libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
|
||||
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
|
||||
$(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
|
||||
$(ppc64_SRCS) $(s390_SRCS) \
|
||||
$(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
|
||||
- $(loongarch_SRCS) $(arc_SRCS)
|
||||
+ $(loongarch_SRCS) $(arc_SRCS) $(mips_SRCS)
|
||||
|
||||
libebl_backends_pic_a_SOURCES =
|
||||
am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_init.c
|
||||
@@ -0,0 +1,52 @@
|
||||
+/* Initialization of MIPS specific backend library.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 mips_
|
||||
+#define RELOC_PREFIX R_MIPS_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include "libelfP.h"
|
||||
+
|
||||
+#define RELOC_TYPE_ID(type) ((type) & 0xff)
|
||||
+
|
||||
+/* This defines the common reloc hooks based on mips_reloc.def. */
|
||||
+#include "common-reloc.c"
|
||||
+
|
||||
+Ebl *
|
||||
+mips_init (Elf *elf __attribute__ ((unused)),
|
||||
+ GElf_Half machine __attribute__ ((unused)),
|
||||
+ Ebl *eh)
|
||||
+{
|
||||
+ /* We handle it. */
|
||||
+ mips_init_reloc (eh);
|
||||
+ HOOK (eh, reloc_simple_type);
|
||||
+ return eh;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_reloc.def
|
||||
@@ -0,0 +1,93 @@
|
||||
+/* List the relocation types for MIPS. -*- C -*-
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 (16, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (32, REL)
|
||||
+RELOC_TYPE (REL32, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (26, REL|DYN)
|
||||
+RELOC_TYPE (HI16, REL)
|
||||
+RELOC_TYPE (LO16, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (GPREL16, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (LITERAL, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (GOT16, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (PC16, REL)
|
||||
+RELOC_TYPE (CALL16, REL)
|
||||
+RELOC_TYPE (GPREL32, REL)
|
||||
+RELOC_TYPE (SHIFT5, REL)
|
||||
+RELOC_TYPE (SHIFT6, REL)
|
||||
+RELOC_TYPE (64, REL)
|
||||
+RELOC_TYPE (GOT_DISP, REL)
|
||||
+RELOC_TYPE (GOT_PAGE, REL)
|
||||
+RELOC_TYPE (GOT_OFST, REL)
|
||||
+RELOC_TYPE (GOT_HI16, REL)
|
||||
+RELOC_TYPE (GOT_LO16, REL)
|
||||
+RELOC_TYPE (SUB, REL)
|
||||
+RELOC_TYPE (INSERT_A, REL)
|
||||
+RELOC_TYPE (INSERT_B, REL)
|
||||
+RELOC_TYPE (DELETE, REL)
|
||||
+RELOC_TYPE (HIGHER, REL)
|
||||
+RELOC_TYPE (HIGHEST, REL)
|
||||
+RELOC_TYPE (CALL_HI16, REL)
|
||||
+RELOC_TYPE (CALL_LO16, REL)
|
||||
+RELOC_TYPE (SCN_DISP, REL)
|
||||
+RELOC_TYPE (REL16, REL)
|
||||
+RELOC_TYPE (ADD_IMMEDIATE, REL)
|
||||
+RELOC_TYPE (PJUMP, REL)
|
||||
+RELOC_TYPE (RELGOT, REL)
|
||||
+RELOC_TYPE (JALR, REL)
|
||||
+RELOC_TYPE (TLS_DTPMOD32, DYN)
|
||||
+RELOC_TYPE (TLS_DTPREL32, REL)
|
||||
+RELOC_TYPE (TLS_DTPMOD64, DYN)
|
||||
+RELOC_TYPE (TLS_DTPREL64, REL)
|
||||
+RELOC_TYPE (TLS_GD, REL)
|
||||
+RELOC_TYPE (TLS_LDM, REL)
|
||||
+RELOC_TYPE (TLS_DTPREL_HI16, REL)
|
||||
+RELOC_TYPE (TLS_DTPREL_LO16, REL)
|
||||
+RELOC_TYPE (TLS_GOTTPREL, REL)
|
||||
+RELOC_TYPE (TLS_TPREL32, REL)
|
||||
+RELOC_TYPE (TLS_TPREL64, REL)
|
||||
+RELOC_TYPE (TLS_TPREL_HI16, REL)
|
||||
+RELOC_TYPE (TLS_TPREL_LO16, REL)
|
||||
+RELOC_TYPE (GLOB_DAT, REL)
|
||||
+RELOC_TYPE (PC21_S2, REL)
|
||||
+RELOC_TYPE (PC26_S2, REL)
|
||||
+RELOC_TYPE (PC18_S3, REL)
|
||||
+RELOC_TYPE (PC19_S2, REL)
|
||||
+RELOC_TYPE (PCHI16, REL)
|
||||
+RELOC_TYPE (PCLO16, REL)
|
||||
+RELOC_TYPE (COPY, REL)
|
||||
+RELOC_TYPE (JUMP_SLOT, REL)
|
||||
+RELOC_TYPE (PC32, REL)
|
||||
+RELOC_TYPE (EH, REL)
|
||||
+RELOC_TYPE (GNU_REL16_S2, REL)
|
||||
+RELOC_TYPE (GNU_VTINHERIT, REL)
|
||||
+RELOC_TYPE (GNU_VTENTRY, REL)
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_symbol.c
|
||||
@@ -0,0 +1,63 @@
|
||||
+/* MIPS specific symbolic name handling.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 <elf.h>
|
||||
+#include <stddef.h>
|
||||
+#include <string.h>
|
||||
+#include <stdio.h>
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include "libelfP.h"
|
||||
+
|
||||
+/* Check for the simple reloc types. */
|
||||
+Elf_Type
|
||||
+mips_reloc_simple_type (Ebl *ebl, int type,
|
||||
+ int *addsub __attribute__ ((unused)))
|
||||
+{
|
||||
+ int typeNew = type;
|
||||
+ if(ebl->elf->class == ELFCLASS64)
|
||||
+ typeNew = ELF64_MIPS_R_TYPE1(type);
|
||||
+ switch (typeNew)
|
||||
+ {
|
||||
+ case R_MIPS_64:
|
||||
+ return ELF_T_XWORD;
|
||||
+ case R_MIPS_32:
|
||||
+ return ELF_T_WORD;
|
||||
+ case R_MIPS_16:
|
||||
+ return ELF_T_HALF;
|
||||
+
|
||||
+ default:
|
||||
+ return ELF_T_NUM;
|
||||
+ }
|
||||
+}
|
||||
--- a/libebl/eblopenbackend.c
|
||||
+++ b/libebl/eblopenbackend.c
|
||||
@@ -57,6 +57,7 @@ Ebl *riscv_init (Elf *, GElf_Half, Ebl *
|
||||
Ebl *csky_init (Elf *, GElf_Half, Ebl *);
|
||||
Ebl *loongarch_init (Elf *, GElf_Half, Ebl *);
|
||||
Ebl *arc_init (Elf *, GElf_Half, Ebl *);
|
||||
+Ebl *mips_init (Elf *, GElf_Half, Ebl *);
|
||||
|
||||
/* This table should contain the complete list of architectures as far
|
||||
as the ELF specification is concerned. */
|
||||
@@ -154,6 +155,7 @@ static const struct
|
||||
{ csky_init, "elf_csky", "csky", 4, EM_CSKY, ELFCLASS32, ELFDATA2LSB },
|
||||
{ loongarch_init, "elf_loongarch", "loongarch", 9, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB },
|
||||
{ arc_init, "elf_arc", "arc", 3, EM_ARCV2, ELFCLASS32, ELFDATA2LSB },
|
||||
+ { mips_init, "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
|
||||
};
|
||||
#define nmachines (sizeof (machines) / sizeof (machines[0]))
|
||||
|
||||
--- a/libelf/libelfP.h
|
||||
+++ b/libelf/libelfP.h
|
||||
@@ -617,4 +617,7 @@ extern void __libelf_reset_rawdata (Elf_
|
||||
#define INVALID_NDX(ndx, type, data) \
|
||||
unlikely ((data)->d_size / sizeof (type) <= (unsigned int) (ndx))
|
||||
|
||||
+#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
|
||||
+#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
|
||||
+#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
|
||||
#endif /* libelfP.h */
|
|
@ -29,11 +29,11 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
|
||||
arc_SRCS = arc_init.c arc_symbol.c
|
||||
|
||||
-mips_SRCS = mips_init.c mips_symbol.c
|
||||
+mips_SRCS = mips_init.c mips_symbol.c mips_attrs.c
|
||||
-mips_SRCS = mips_init.c mips_symbol.c mips_initreg.c \
|
||||
+mips_SRCS = mips_init.c mips_symbol.c mips_attrs.c mips_initreg.c \
|
||||
mips_cfi.c mips_unwind.c mips_regs.c mips_retval.c \
|
||||
mips_corenote.c
|
||||
|
||||
libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
|
||||
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_attrs.c
|
||||
@@ -0,0 +1,140 @@
|
||||
|
@ -179,7 +179,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
+}
|
||||
--- a/backends/mips_init.c
|
||||
+++ b/backends/mips_init.c
|
||||
@@ -48,5 +48,12 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
@@ -48,6 +48,13 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
/* We handle it. */
|
||||
mips_init_reloc (eh);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
|
@ -190,8 +190,9 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
+ HOOK (eh, dynamic_tag_check);
|
||||
+ HOOK (eh, dynamic_tag_name);
|
||||
+ HOOK (eh, check_object_attribute);
|
||||
return eh;
|
||||
}
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, unwind);
|
||||
--- a/backends/mips_symbol.c
|
||||
+++ b/backends/mips_symbol.c
|
||||
@@ -61,3 +61,574 @@ mips_reloc_simple_type (Ebl *ebl, int ty
|
||||
|
@ -771,7 +772,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
+}
|
||||
--- a/libelf/libelfP.h
|
||||
+++ b/libelf/libelfP.h
|
||||
@@ -620,4 +620,5 @@ extern void __libelf_reset_rawdata (Elf_
|
||||
@@ -624,4 +624,5 @@ extern void __libelf_reset_rawdata (Elf_
|
||||
#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
|
||||
#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
|
||||
#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
|
||||
|
@ -993,7 +994,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -12043,7 +12139,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
|
||||
@@ -12037,7 +12133,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
|
||||
|
@ -1002,7 +1003,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
{
|
||||
const char *name = elf_strptr (ebl->elf, shstrndx,
|
||||
shdr->sh_name);
|
||||
@@ -12073,7 +12169,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
|
||||
@@ -12067,7 +12163,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
|
||||
|
@ -1013,25 +1014,24 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
{
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -214,7 +214,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
@@ -216,7 +216,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
|
||||
run-readelf-dw-form-indirect.sh run-strip-largealign.sh \
|
||||
run-readelf-Dd.sh run-dwfl-core-noncontig.sh run-cu-dwp-section-info.sh \
|
||||
- run-declfiles.sh
|
||||
+ run-declfiles.sh run-readelf-reloc.sh
|
||||
- run-declfiles.sh \
|
||||
+ run-declfiles.sh run-readelf-reloc.sh \
|
||||
run-sysroot.sh
|
||||
|
||||
if !BIARCH
|
||||
export ELFUTILS_DISABLE_BIARCH = 1
|
||||
@@ -646,7 +646,8 @@ EXTRA_DIST = run-arextract.sh run-arsymt
|
||||
testfile-dwp-5-cu-index-overflow.dwp.bz2 \
|
||||
@@ -684,7 +684,7 @@ EXTRA_DIST = run-arextract.sh run-arsymt
|
||||
testfile-dwp-4-cu-index-overflow.bz2 \
|
||||
testfile-dwp-4-cu-index-overflow.dwp.bz2 \
|
||||
- testfile-dwp-cu-index-overflow.source
|
||||
+ testfile-dwp-cu-index-overflow.source \
|
||||
+ run-readelf-reloc.sh
|
||||
testfile-dwp-cu-index-overflow.source \
|
||||
- testfile-define-file.bz2 \
|
||||
+ run-readelf-reloc.sh testfile-define-file.bz2 \
|
||||
testfile-sysroot.tar.bz2 run-sysroot.sh run-debuginfod-seekable.sh
|
||||
|
||||
|
||||
if USE_VALGRIND
|
||||
--- /dev/null
|
||||
+++ b/tests/run-readelf-reloc.sh
|
||||
@@ -0,0 +1,42 @@
|
||||
|
|
|
@ -29,7 +29,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
|
||||
--- a/backends/mips_init.c
|
||||
+++ b/backends/mips_init.c
|
||||
@@ -51,9 +51,12 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
@@ -51,10 +51,13 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
HOOK (eh, section_type_name);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, machine_flag_name);
|
||||
|
@ -40,8 +40,9 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
HOOK (eh, check_object_attribute);
|
||||
+ HOOK (eh, check_special_symbol);
|
||||
+ HOOK (eh, check_reloc_target_type);
|
||||
return eh;
|
||||
}
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, unwind);
|
||||
--- a/backends/mips_symbol.c
|
||||
+++ b/backends/mips_symbol.c
|
||||
@@ -158,6 +158,43 @@ mips_section_type_name (int type,
|
||||
|
@ -101,7 +102,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
ERROR (_("\
|
||||
section [%2d] '%s': symbol %zu (%s): non-local section symbol\n"),
|
||||
idx, section_name (ebl, idx), cnt, name);
|
||||
@@ -3828,6 +3830,10 @@ cannot get section header for section [%
|
||||
@@ -3829,6 +3831,10 @@ cannot get section header for section [%
|
||||
&& ebl_bss_plt_p (ebl))
|
||||
good_type = SHT_NOBITS;
|
||||
|
||||
|
@ -112,7 +113,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
/* In a debuginfo file, any normal section can be SHT_NOBITS.
|
||||
This is only invalid for DWARF sections and .shstrtab. */
|
||||
if (shdr->sh_type != good_type
|
||||
@@ -3988,12 +3994,21 @@ section [%2zu] '%s': size not multiple o
|
||||
@@ -3989,12 +3995,21 @@ section [%2zu] '%s': size not multiple o
|
||||
ERROR (_("section [%2zu] '%s'"
|
||||
" contains invalid processor-specific flag(s)"
|
||||
" %#" PRIx64 "\n"),
|
||||
|
@ -137,7 +138,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
if (sh_flags != 0)
|
||||
ERROR (_("section [%2zu] '%s' contains unknown flag(s)"
|
||||
" %#" PRIx64 "\n"),
|
||||
@@ -4059,6 +4074,7 @@ section [%2zu] '%s': merge flag set but
|
||||
@@ -4060,6 +4075,7 @@ section [%2zu] '%s': merge flag set but
|
||||
switch (shdr->sh_type)
|
||||
{
|
||||
case SHT_PROGBITS:
|
||||
|
@ -145,7 +146,7 @@ Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
|||
break;
|
||||
|
||||
case SHT_NOBITS:
|
||||
@@ -4716,7 +4732,7 @@ program header offset in ELF header and
|
||||
@@ -4717,7 +4733,7 @@ program header offset in ELF header and
|
||||
if (shdr != NULL
|
||||
&& ((is_debuginfo && shdr->sh_type == SHT_NOBITS)
|
||||
|| (! is_debuginfo
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
From f2acb06970522a9563d82490f2f1b8fc0bb5b720 Mon Sep 17 00:00:00 2001
|
||||
From: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
Date: Tue, 5 Mar 2024 17:51:21 +0800
|
||||
Subject: [PATCH] stack: Fix stack unwind failure on mips
|
||||
|
||||
Add abi_cfi, set_initial_registers_tid, unwind on mips.
|
||||
|
||||
* backends/Makefile.am (mips_SRCS): Add mips_initreg.c,
|
||||
mips_cfi.c and mips_unwind.c.
|
||||
* backends/mips_init.c (mips_init): HOOK abi_cfi, unwind and
|
||||
set_initial_registers_tid. Set frame_nregs to 71.
|
||||
* backends/mips_cfi.c: New file.
|
||||
* backends/mips_initreg.c: Likewise.
|
||||
* backends/mips_unwind.c: Likewise.
|
||||
|
||||
Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
---
|
||||
backends/Makefile.am | 3 +-
|
||||
backends/mips_cfi.c | 68 +++++++++++++++++++++++++++++++++
|
||||
backends/mips_init.c | 4 ++
|
||||
backends/mips_initreg.c | 61 ++++++++++++++++++++++++++++++
|
||||
backends/mips_unwind.c | 84 +++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 219 insertions(+), 1 deletion(-)
|
||||
create mode 100644 backends/mips_cfi.c
|
||||
create mode 100644 backends/mips_initreg.c
|
||||
create mode 100644 backends/mips_unwind.c
|
||||
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -102,7 +102,8 @@ loongarch_SRCS = loongarch_init.c loonga
|
||||
|
||||
arc_SRCS = arc_init.c arc_symbol.c
|
||||
|
||||
-mips_SRCS = mips_init.c mips_symbol.c mips_attrs.c
|
||||
+mips_SRCS = mips_init.c mips_symbol.c mips_attrs.c mips_initreg.c \
|
||||
+ mips_cfi.c mips_unwind.c
|
||||
|
||||
libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
|
||||
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_cfi.c
|
||||
@@ -0,0 +1,68 @@
|
||||
+/* MIPS ABI-specified defaults for DWARF CFI.
|
||||
+ Copyright (C) 2009 Red Hat, Inc.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+int
|
||||
+mips_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
+{
|
||||
+ static const uint8_t abi_cfi[] =
|
||||
+ {
|
||||
+ DW_CFA_def_cfa, ULEB128_7 (31), ULEB128_7 (0),
|
||||
+ /* Callee-saved regs. */
|
||||
+ DW_CFA_same_value, ULEB128_7 (16), /* s0 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (17), /* s1 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (18), /* s2 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (19), /* s3 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (20), /* s4 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (21), /* s5 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (22), /* s6 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (23), /* s7 */
|
||||
+ DW_CFA_same_value, ULEB128_7 (28), /* gp */
|
||||
+ DW_CFA_same_value, ULEB128_7 (29), /* sp */
|
||||
+ DW_CFA_same_value, ULEB128_7 (30), /* fp */
|
||||
+
|
||||
+ DW_CFA_val_offset, ULEB128_7 (29), ULEB128_7 (0),
|
||||
+ };
|
||||
+
|
||||
+ abi_info->initial_instructions = abi_cfi;
|
||||
+ abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
+ abi_info->data_alignment_factor = 8;
|
||||
+
|
||||
+ abi_info->return_address_register = 31; /* %ra */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/backends/mips_init.c
|
||||
+++ b/backends/mips_init.c
|
||||
@@ -58,5 +58,9 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
HOOK (eh, check_object_attribute);
|
||||
HOOK (eh, check_special_symbol);
|
||||
HOOK (eh, check_reloc_target_type);
|
||||
+ HOOK (eh, set_initial_registers_tid);
|
||||
+ HOOK (eh, abi_cfi);
|
||||
+ HOOK (eh, unwind);
|
||||
+ eh->frame_nregs = 71;
|
||||
return eh;
|
||||
}
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_initreg.c
|
||||
@@ -0,0 +1,61 @@
|
||||
+/* Fetch live process registers from TID.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 <stdlib.h>
|
||||
+#if (defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)) && defined(__linux__)
|
||||
+# include <sys/user.h>
|
||||
+# include <sys/ptrace.h>
|
||||
+#include <asm/ptrace.h>
|
||||
+#endif
|
||||
+
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+
|
||||
+bool
|
||||
+mips_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
+ ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
+ void *arg __attribute__ ((unused)))
|
||||
+{
|
||||
+#if (!defined(mips) && !defined(__mips) && !defined(__mips__) && !defined(MIPS) && !defined(__MIPS__)) || !defined(__linux__)
|
||||
+ return false;
|
||||
+#else /* __mips__ */
|
||||
+/* For PTRACE_GETREGS */
|
||||
+
|
||||
+ struct pt_regs gregs;
|
||||
+ if (ptrace (PTRACE_GETREGS, tid, 0, &gregs) != 0)
|
||||
+ return false;
|
||||
+ if (! setfunc (-1, 1, (Dwarf_Word *) &gregs.cp0_epc, arg))
|
||||
+ return false;
|
||||
+ return setfunc (0, 32, (Dwarf_Word *) &gregs.regs[0], arg);
|
||||
+#endif /* __mips__ */
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_unwind.c
|
||||
@@ -0,0 +1,84 @@
|
||||
+/* Get previous frame state for an existing frame state.
|
||||
+ Copyright (C) 2016 The Qt Company Ltd.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 mips_
|
||||
+#define SP_REG 29
|
||||
+#define FP_REG 30
|
||||
+#define LR_REG 31
|
||||
+#define FP_OFFSET 0
|
||||
+#define LR_OFFSET 8
|
||||
+#define SP_OFFSET 16
|
||||
+
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* There was no CFI. Maybe we happen to have a frame pointer and can unwind from that? */
|
||||
+
|
||||
+bool
|
||||
+EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)), Dwarf_Addr pc __attribute__ ((unused)),
|
||||
+ ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc,
|
||||
+ ebl_pid_memory_read_t *readfunc, void *arg,
|
||||
+ bool *signal_framep __attribute__ ((unused)))
|
||||
+{
|
||||
+ Dwarf_Word fp, lr, sp;
|
||||
+
|
||||
+ if (!getfunc(LR_REG, 1, &lr, arg))
|
||||
+ return false;
|
||||
+
|
||||
+ if (lr == 0 || !setfunc(-1, 1, &lr, arg))
|
||||
+ return false;
|
||||
+
|
||||
+ if (!getfunc(FP_REG, 1, &fp, arg))
|
||||
+ fp = 0;
|
||||
+
|
||||
+ if (!getfunc(SP_REG, 1, &sp, arg))
|
||||
+ sp = 0;
|
||||
+
|
||||
+ Dwarf_Word newLr, newFp, newSp;
|
||||
+
|
||||
+ if (!readfunc(fp + LR_OFFSET, &newLr, arg))
|
||||
+ newLr = 0;
|
||||
+
|
||||
+ if (!readfunc(fp + FP_OFFSET, &newFp, arg))
|
||||
+ newFp = 0;
|
||||
+
|
||||
+ newSp = fp + SP_OFFSET;
|
||||
+
|
||||
+ // These are not fatal if they don't work. They will just prevent unwinding at the next frame.
|
||||
+ setfunc(LR_REG, 1, &newLr, arg);
|
||||
+ setfunc(FP_REG, 1, &newFp, arg);
|
||||
+ setfunc(SP_REG, 1, &newSp, arg);
|
||||
+
|
||||
+ // If the fp is invalid, we might still have a valid lr.
|
||||
+ // But if the fp is valid, then the stack should be moving in the right direction.
|
||||
+ return fp == 0 || newSp > sp;
|
||||
+}
|
|
@ -1,475 +0,0 @@
|
|||
From db33cb0cac3253c34881c0377ada51d9803eaae0 Mon Sep 17 00:00:00 2001
|
||||
From: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
Date: Tue, 5 Mar 2024 17:51:22 +0800
|
||||
Subject: [PATCH] backends: Add register_info, return_value_location, core_note
|
||||
on mips
|
||||
|
||||
* backends/Makefile.am (mips_SRCS): Add mips_regs.c,
|
||||
mips_retval.c and mips_corenote.c.
|
||||
* backends/mips_init.c (mips_init): HOOK register_info,
|
||||
return_value_location and core_note.
|
||||
* backends/mips_corenote.c: New file.
|
||||
* backends/mips_regs.c: Likewise.
|
||||
* backends/mips_retval.c: Likewise.
|
||||
|
||||
Signed-off-by: Ying Huang <ying.huang@oss.cipunited.com>
|
||||
---
|
||||
backends/Makefile.am | 3 +-
|
||||
backends/mips_corenote.c | 85 +++++++++++++++++
|
||||
backends/mips_init.c | 3 +
|
||||
backends/mips_regs.c | 135 +++++++++++++++++++++++++++
|
||||
backends/mips_retval.c | 196 +++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 421 insertions(+), 1 deletion(-)
|
||||
create mode 100644 backends/mips_corenote.c
|
||||
create mode 100644 backends/mips_regs.c
|
||||
create mode 100644 backends/mips_retval.c
|
||||
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -103,7 +103,8 @@ loongarch_SRCS = loongarch_init.c loonga
|
||||
arc_SRCS = arc_init.c arc_symbol.c
|
||||
|
||||
mips_SRCS = mips_init.c mips_symbol.c mips_attrs.c mips_initreg.c \
|
||||
- mips_cfi.c mips_unwind.c
|
||||
+ mips_cfi.c mips_unwind.c mips_regs.c mips_retval.c \
|
||||
+ mips_corenote.c
|
||||
|
||||
libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
|
||||
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_corenote.c
|
||||
@@ -0,0 +1,85 @@
|
||||
+/* MIPS specific core note handling.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+#define BITS 64
|
||||
+#ifndef BITS
|
||||
+# define BITS 32
|
||||
+#else
|
||||
+# define BITS 64
|
||||
+#endif
|
||||
+
|
||||
+#define PRSTATUS_REGS_SIZE (45 * (BITS / 8))
|
||||
+static const Ebl_Register_Location prstatus_regs[] =
|
||||
+ {
|
||||
+ { .offset = 0, .regno = 0, .count = (BITS == 32 ? 40 : 34), .bits = BITS },
|
||||
+ { .offset = BITS/8 * (BITS == 32 ? 41 : 35), .regno = (BITS == 32 ? 41 : 35), .count = (BITS == 32 ? 4 : 10), .bits = BITS },
|
||||
+ };
|
||||
+
|
||||
+#define PRSTATUS_REGSET_ITEMS \
|
||||
+ { \
|
||||
+ .name = "pc", .type = ELF_T_ADDR, .format = 'x', \
|
||||
+ .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + ((BITS/8) * (BITS == 32 ? 40 : 34)), \
|
||||
+ .group = "register", \
|
||||
+ .pc_register = true \
|
||||
+ }
|
||||
+
|
||||
+#if BITS == 32
|
||||
+# define ULONG uint32_t
|
||||
+# define ALIGN_ULONG 4
|
||||
+# define TYPE_ULONG ELF_T_WORD
|
||||
+#define TYPE_LONG ELF_T_SWORD
|
||||
+#else
|
||||
+#define ULONG uint64_t
|
||||
+#define ALIGN_ULONG 8
|
||||
+#define TYPE_ULONG ELF_T_XWORD
|
||||
+#define TYPE_LONG ELF_T_SXWORD
|
||||
+#endif
|
||||
+#define PID_T int32_t
|
||||
+#define UID_T uint32_t
|
||||
+#define GID_T uint32_t
|
||||
+#define ALIGN_PID_T 4
|
||||
+#define ALIGN_UID_T 4
|
||||
+#define ALIGN_GID_T 4
|
||||
+#define TYPE_PID_T ELF_T_SWORD
|
||||
+#define TYPE_UID_T ELF_T_WORD
|
||||
+#define TYPE_GID_T ELF_T_WORD
|
||||
+
|
||||
+#include "linux-core-note.c"
|
||||
--- a/backends/mips_init.c
|
||||
+++ b/backends/mips_init.c
|
||||
@@ -61,6 +61,9 @@ mips_init (Elf *elf __attribute__ ((unus
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, unwind);
|
||||
+ HOOK (eh, register_info);
|
||||
+ HOOK (eh, return_value_location);
|
||||
+ HOOK (eh, core_note);
|
||||
eh->frame_nregs = 71;
|
||||
return eh;
|
||||
}
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_regs.c
|
||||
@@ -0,0 +1,135 @@
|
||||
+/* Register names and numbers for mips DWARF.
|
||||
+ Copyright (C) 2006 Red Hat, Inc.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 <dwarf.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include <system.h>
|
||||
+ssize_t
|
||||
+mips_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 72;
|
||||
+
|
||||
+ if (regno < 0 || regno > 71 || namelen < 4)
|
||||
+ return -1;
|
||||
+
|
||||
+ *prefix = "$";
|
||||
+ if (regno < 38)
|
||||
+ {
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *setname = "FPU";
|
||||
+ *type = DW_ATE_float;
|
||||
+ *bits = 64;
|
||||
+ }
|
||||
+
|
||||
+ if (regno < 32)
|
||||
+ {
|
||||
+ if (regno < 10)
|
||||
+ {
|
||||
+ name[0] = regno + '0';
|
||||
+ namelen = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ name[0] = (regno / 10) + '0';
|
||||
+ name[1] = (regno % 10) + '0';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+ if (regno == 28 || regno == 29 || regno == 31)
|
||||
+ *type = DW_ATE_address;
|
||||
+ }
|
||||
+ else if (regno == 32)
|
||||
+ {
|
||||
+ return stpcpy (name, "lo") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 33)
|
||||
+ {
|
||||
+ return stpcpy (name, "hi") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 34)
|
||||
+ {
|
||||
+ return stpcpy (name, "pc") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 35)
|
||||
+ {
|
||||
+ *type = DW_ATE_address;
|
||||
+ return stpcpy (name, "bad") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 36)
|
||||
+ {
|
||||
+ return stpcpy (name, "sr") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 37)
|
||||
+ {
|
||||
+ *type = DW_ATE_address;
|
||||
+ return stpcpy (name, "cause") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno < 70)
|
||||
+ {
|
||||
+ name[0] = 'f';
|
||||
+ if (regno < 38 + 10)
|
||||
+ {
|
||||
+ name[1] = (regno - 38) + '0';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ name[1] = (regno - 38) / 10 + '0';
|
||||
+ name[2] = (regno - 38) % 10 + '0';
|
||||
+ namelen = 3;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (regno == 70)
|
||||
+ {
|
||||
+ return stpcpy (name, "fsr") + 1 - name;
|
||||
+ }
|
||||
+ else if (regno == 71)
|
||||
+ {
|
||||
+ return stpcpy (name, "fir") + 1 - name;
|
||||
+ }
|
||||
+
|
||||
+ name[namelen++] = '\0';
|
||||
+ return namelen;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/backends/mips_retval.c
|
||||
@@ -0,0 +1,196 @@
|
||||
+/* Function return value location for Linux/mips ABI.
|
||||
+ Copyright (C) 2005 Red Hat, Inc.
|
||||
+ Copyright (C) 2024 CIP United Inc.
|
||||
+ 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 <dwarf.h>
|
||||
+#include <string.h>
|
||||
+#include <elf.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include "libdwP.h"
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+/* $v0 or pair $v0, $v1 */
|
||||
+static const Dwarf_Op loc_intreg_o32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+
|
||||
+static const Dwarf_Op loc_intreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ };
|
||||
+#define nloc_intreg 1
|
||||
+#define nloc_intregpair 4
|
||||
+
|
||||
+/* $f0 (float), or pair $f0, $f1 (double).
|
||||
+ * f2/f3 are used for COMPLEX (= 2 doubles) returns in Fortran */
|
||||
+static const Dwarf_Op loc_fpreg_o32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+
|
||||
+/* $f0, or pair $f0, $f2. */
|
||||
+static const Dwarf_Op loc_fpreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ };
|
||||
+#define nloc_fpreg 1
|
||||
+#define nloc_fpregpair 4
|
||||
+#define nloc_fpregquad 8
|
||||
+
|
||||
+/* The return value is a structure and is actually stored in stack space
|
||||
+ passed in a hidden argument by the caller. But, the compiler
|
||||
+ helpfully returns the address of that space in $v0. */
|
||||
+static const Dwarf_Op loc_aggregate[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_breg2, .number = 0 }
|
||||
+ };
|
||||
+#define nloc_aggregate 1
|
||||
+
|
||||
+int
|
||||
+mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ unsigned int regsize = (gelf_getclass (functypedie->cu->dbg->elf) == ELFCLASS32 ) ? 4 : 8;
|
||||
+ if (!regsize)
|
||||
+ return -2;
|
||||
+
|
||||
+ /* Start with the function's type, and get the DW_AT_type attribute,
|
||||
+ which is the type of the return value. */
|
||||
+
|
||||
+ Dwarf_Attribute attr_mem;
|
||||
+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
|
||||
+ if (attr == NULL)
|
||||
+ /* The function has no return value, like a `void' function in C. */
|
||||
+ return 0;
|
||||
+
|
||||
+ Dwarf_Die die_mem;
|
||||
+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ int tag = dwarf_tag (typedie);
|
||||
+
|
||||
+ /* Follow typedefs and qualifiers to get to the actual type. */
|
||||
+ while (tag == DW_TAG_typedef
|
||||
+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
|
||||
+ || tag == DW_TAG_restrict_type)
|
||||
+ {
|
||||
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
+ typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ tag = dwarf_tag (typedie);
|
||||
+ }
|
||||
+
|
||||
+ switch (tag)
|
||||
+ {
|
||||
+ case -1:
|
||||
+ return -1;
|
||||
+
|
||||
+ case DW_TAG_subrange_type:
|
||||
+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
+ {
|
||||
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
+ typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ tag = dwarf_tag (typedie);
|
||||
+ }
|
||||
+ /* Fall through. */
|
||||
+ FALLTHROUGH;
|
||||
+
|
||||
+ case DW_TAG_base_type:
|
||||
+ case DW_TAG_enumeration_type:
|
||||
+ CASE_POINTER:
|
||||
+ {
|
||||
+ Dwarf_Word size;
|
||||
+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
+ &attr_mem), &size) != 0)
|
||||
+ {
|
||||
+ if (dwarf_is_pointer (tag))
|
||||
+ size = regsize;
|
||||
+ else
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (tag == DW_TAG_base_type)
|
||||
+ {
|
||||
+ Dwarf_Word encoding;
|
||||
+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
+ &attr_mem), &encoding) != 0)
|
||||
+ return -1;
|
||||
+
|
||||
+#define ARCH_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc))
|
||||
+
|
||||
+ if (encoding == DW_ATE_float)
|
||||
+ {
|
||||
+ *locp = ARCH_LOC(loc_fpreg, regsize);
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_fpreg;
|
||||
+
|
||||
+ if (size <= 2*regsize)
|
||||
+ return nloc_fpregpair;
|
||||
+
|
||||
+ if (size <= 4*regsize)
|
||||
+ return nloc_fpregquad;
|
||||
+
|
||||
+ goto aggregate;
|
||||
+ }
|
||||
+ }
|
||||
+ *locp = ARCH_LOC(loc_intreg, regsize);
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_intreg;
|
||||
+ if (size <= 2*regsize)
|
||||
+ return nloc_intregpair;
|
||||
+
|
||||
+ /* Else fall through. Shouldn't happen though (at least with gcc) */
|
||||
+ }
|
||||
+ FALLTHROUGH;
|
||||
+
|
||||
+ case DW_TAG_structure_type:
|
||||
+ case DW_TAG_class_type:
|
||||
+ case DW_TAG_union_type:
|
||||
+ case DW_TAG_array_type:
|
||||
+ aggregate:
|
||||
+ *locp = loc_aggregate;
|
||||
+ return nloc_aggregate;
|
||||
+ case DW_TAG_unspecified_type:
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
+ This value means we do not understand the type, but it is well-formed
|
||||
+ DWARF and might be valid. */
|
||||
+ return -2;
|
||||
+}
|
|
@ -1,29 +0,0 @@
|
|||
From ef8a4b841aaf26326b8961a651dbe915d54d23e7 Mon Sep 17 00:00:00 2001
|
||||
From: Jose Quaresma <quaresma.jose@gmail.com>
|
||||
Date: Tue, 19 Mar 2024 10:34:33 +0000
|
||||
Subject: [PATCH] srcfiles: fix unused variable BUFFER_SIZE
|
||||
|
||||
The const variable BUFFER_SIZE is used only on the zip_files
|
||||
function witch is only available with LIBARCHIVE.
|
||||
|
||||
| ../../elfutils-0.191/src/srcfiles.cxx:81:18: error: unused variable 'BUFFER_SIZE' [-Werror,-Wunused-const-variable]
|
||||
| 81 | constexpr size_t BUFFER_SIZE = 8192;
|
||||
| | ^~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
|
||||
---
|
||||
src/srcfiles.cxx | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/src/srcfiles.cxx
|
||||
+++ b/src/srcfiles.cxx
|
||||
@@ -78,7 +78,9 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = print_ve
|
||||
/* Bug report address. */
|
||||
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
|
||||
|
||||
+#ifdef HAVE_LIBARCHIVE
|
||||
constexpr size_t BUFFER_SIZE = 8192;
|
||||
+#endif
|
||||
|
||||
/* Definitions of arguments for argp functions. */
|
||||
static const struct argp_option options[] =
|
|
@ -1,29 +0,0 @@
|
|||
From c981e61aa301d389f18df5fd279c1ca4d39d38a0 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Pratt <mcpratt@pm.me>
|
||||
Date: Thu, 10 Oct 2024 10:26:54 +0000
|
||||
Subject: [PATCH] lib: Add missing config.h include to next_prime.c
|
||||
|
||||
This is the last remaining C source file as of this commit
|
||||
without the standard conditional inclusion of config.h
|
||||
as the very first header.
|
||||
|
||||
* lib/next_prime.c: add missing config.h header.
|
||||
|
||||
Signed-off-by: Michael Pratt <mcpratt@pm.me>
|
||||
---
|
||||
lib/next_prime.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/lib/next_prime.c
|
||||
+++ b/lib/next_prime.c
|
||||
@@ -27,6 +27,10 @@
|
||||
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 <stddef.h>
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
From 7f06ac2b3fc0077f29bcc68064ca8e91fa7cd080 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Pratt <mcpratt@pm.me>
|
||||
Date: Thu, 10 Oct 2024 10:27:02 +0000
|
||||
Subject: [PATCH] libcpu: Include config.h before standard headers in lexer
|
||||
source
|
||||
|
||||
As part of the processing of flex, definitions and headers
|
||||
are added to output source before any literal text or generated code.
|
||||
|
||||
This causes standard headers to come before config.h
|
||||
unless config.h is included in a %top block instead
|
||||
as specified in the flex manual, section 5.1 "Format of the Definitions".
|
||||
|
||||
The %top block is non-POSIX, so using it reinforces
|
||||
the requirement of "flex" over a standardized "lex" even more.
|
||||
|
||||
* libcpu/i386_lex.l (%top): add flex %top block
|
||||
and move config.h header inclusion to it.
|
||||
|
||||
Signed-off-by: Michael Pratt <mcpratt@pm.me>
|
||||
---
|
||||
libcpu/i386_lex.l | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/libcpu/i386_lex.l
|
||||
+++ b/libcpu/i386_lex.l
|
||||
@@ -1,3 +1,9 @@
|
||||
+%top{
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
%{
|
||||
/* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
|
||||
@@ -26,10 +32,6 @@
|
||||
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 <ctype.h>
|
||||
|
||||
#include <libeu.h>
|
|
@ -1,43 +0,0 @@
|
|||
From b68f34725229b08380a1612899b0537f8f597dad Mon Sep 17 00:00:00 2001
|
||||
From: Michael Pratt <mcpratt@pm.me>
|
||||
Date: Thu, 10 Oct 2024 10:27:09 +0000
|
||||
Subject: [PATCH] libdw: Let clean targets be unconditional
|
||||
|
||||
The automake rule "maintainer-clean-generic"
|
||||
is always available and never conditional,
|
||||
so let the variable that uses it be define
|
||||
non-conditionally.
|
||||
|
||||
If one actually wants conditional cleaning
|
||||
they should write a custom rule and set it
|
||||
as a dependency of a "*clean-local" automake rule.
|
||||
|
||||
There is no need to do conditional cleaning here,
|
||||
so move the MAINTAINERCLEANFILES variable definition
|
||||
to the end of the Makefile.am file as it is
|
||||
in the rest of the project.
|
||||
|
||||
* libdw/Makefile.am: move MAINTAINERCLEANFILES
|
||||
variable to the end of the file
|
||||
as a non-conditional definition.
|
||||
|
||||
Signed-off-by: Michael Pratt <mcpratt@pm.me>
|
||||
---
|
||||
libdw/Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -97,7 +97,6 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_be
|
||||
|
||||
if MAINTAINER_MODE
|
||||
BUILT_SOURCES = $(srcdir)/known-dwarf.h
|
||||
-MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
|
||||
$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
|
||||
gawk -f $^ > $@.new
|
||||
mv -f $@.new $@
|
||||
@@ -154,3 +153,4 @@ noinst_HEADERS = libdwP.h memory-access.
|
||||
EXTRA_DIST = libdw.map
|
||||
|
||||
MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so libdw.so.$(VERSION)
|
||||
+MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
|
|
@ -1,687 +0,0 @@
|
|||
From 12d58cf3e30dee91ed7aadb6475a15c6e74cc88b Mon Sep 17 00:00:00 2001
|
||||
From: Michael Pratt <mcpratt@pm.me>
|
||||
Date: Wed, 16 Oct 2024 19:53:52 +0000
|
||||
Subject: [PATCH] Remove usage of "unlocked" variant of stdio print functions
|
||||
|
||||
These "unlocked" Linux Standard Base variants of standard functions
|
||||
are not available on some systems that are still capable
|
||||
of building Linux and ELFs.
|
||||
|
||||
The difference is negligible for simple printing to stdout.
|
||||
|
||||
POSIX also states for the similar putc_unlocked():
|
||||
|
||||
These functions can safely be used in a multi-threaded program
|
||||
if and only if they are called while the invoking thread owns
|
||||
the (FILE *) object, as is the case after a successful call
|
||||
to the flockfile() or ftrylockfile() functions.
|
||||
|
||||
...
|
||||
|
||||
These unlocked versions can be safely used
|
||||
only within explicitly locked program regions,
|
||||
using exported locking primitives.
|
||||
|
||||
and these precautions were never done.
|
||||
|
||||
Use the standard forms of these print functions.
|
||||
|
||||
There is inconsistent use of fputc_unlocked() with putc_unlocked(),
|
||||
so consistently use the safer fputc() instead.
|
||||
|
||||
Signed-off-by: Michael Pratt <mcpratt@pm.me>
|
||||
---
|
||||
libasm/asm_align.c | 4 +-
|
||||
libcpu/i386_parse.y | 4 +-
|
||||
libebl/eblobjnote.c | 4 +-
|
||||
src/nm.c | 20 +++++-----
|
||||
src/objdump.c | 24 ++++++------
|
||||
src/readelf.c | 90 ++++++++++++++++++++++-----------------------
|
||||
src/size.c | 8 ++--
|
||||
src/strings.c | 20 +++++-----
|
||||
tests/showptable.c | 8 ++--
|
||||
9 files changed, 91 insertions(+), 91 deletions(-)
|
||||
|
||||
--- a/libasm/asm_align.c
|
||||
+++ b/libasm/asm_align.c
|
||||
@@ -60,13 +60,13 @@ asm_align (AsmScn_t *asmscn, GElf_Word v
|
||||
fprintf (asmscn->ctx->out.file, "%02hhx\n", asmscn->pattern->bytes[0]);
|
||||
else
|
||||
{
|
||||
- fputc_unlocked ('"', asmscn->ctx->out.file);
|
||||
+ fputc ('"', asmscn->ctx->out.file);
|
||||
|
||||
for (size_t cnt = 0; cnt < asmscn->pattern->len; ++cnt)
|
||||
fprintf (asmscn->ctx->out.file, "\\x%02hhx",
|
||||
asmscn->pattern->bytes[cnt]);
|
||||
|
||||
- fputs_unlocked ("\"\n", asmscn->ctx->out.file);
|
||||
+ fputs ("\"\n", asmscn->ctx->out.file);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
--- a/libcpu/i386_parse.y
|
||||
+++ b/libcpu/i386_parse.y
|
||||
@@ -1158,7 +1158,7 @@ instrtable_out (void)
|
||||
EMIT_SUFFIX (w1);
|
||||
EMIT_SUFFIX (W1);
|
||||
|
||||
- fputc_unlocked ('\n', outfile);
|
||||
+ fputc ('\n', outfile);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
@@ -1333,7 +1333,7 @@ instrtable_out (void)
|
||||
b = b->next;
|
||||
}
|
||||
|
||||
- fputc_unlocked ('\n', outfile);
|
||||
+ fputc ('\n', outfile);
|
||||
}
|
||||
fputs ("};\n", outfile);
|
||||
}
|
||||
--- a/libebl/eblobjnote.c
|
||||
+++ b/libebl/eblobjnote.c
|
||||
@@ -643,10 +643,10 @@ ebl_object_note (Ebl *ebl, uint32_t name
|
||||
for (size_t cnt = 1; cnt < descsz / 4; ++cnt)
|
||||
{
|
||||
if (cnt > 1)
|
||||
- putchar_unlocked ('.');
|
||||
+ putchar ('.');
|
||||
printf ("%" PRIu32, buf[cnt]);
|
||||
}
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
if (descsz / 4 > FIXED_TAG_BYTES)
|
||||
free (buf);
|
||||
--- a/src/nm.c
|
||||
+++ b/src/nm.c
|
||||
@@ -439,7 +439,7 @@ handle_ar (int fd, Elf *elf, const char
|
||||
Elf_Arhdr *arhdr = NULL;
|
||||
size_t arhdr_off = 0; /* Note: 0 is no valid offset. */
|
||||
|
||||
- fputs_unlocked (_("\nArchive index:\n"), stdout);
|
||||
+ fputs (_("\nArchive index:\n"), stdout);
|
||||
|
||||
while (arsym->as_off != 0)
|
||||
{
|
||||
@@ -825,8 +825,8 @@ show_symbols_sysv (Ebl *ebl, GElf_Word s
|
||||
/* If we have to precede the line with the file name. */
|
||||
if (print_file_name)
|
||||
{
|
||||
- fputs_unlocked (fullname, stdout);
|
||||
- putchar_unlocked (':');
|
||||
+ fputs (fullname, stdout);
|
||||
+ putchar (':');
|
||||
}
|
||||
|
||||
/* Convert the address. */
|
||||
@@ -972,8 +972,8 @@ show_symbols_bsd (Elf *elf, const GElf_E
|
||||
/* If we have to precede the line with the file name. */
|
||||
if (print_file_name)
|
||||
{
|
||||
- fputs_unlocked (fullname, stdout);
|
||||
- putchar_unlocked (':');
|
||||
+ fputs (fullname, stdout);
|
||||
+ putchar (':');
|
||||
}
|
||||
|
||||
bool is_tls = GELF_ST_TYPE (syms[cnt].sym.st_info) == STT_TLS;
|
||||
@@ -1046,8 +1046,8 @@ show_symbols_bsd (Elf *elf, const GElf_E
|
||||
}
|
||||
|
||||
if (color_mode)
|
||||
- fputs_unlocked (color_off, stdout);
|
||||
- putchar_unlocked ('\n');
|
||||
+ fputs (color_off, stdout);
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
#ifdef USE_DEMANGLE
|
||||
@@ -1104,9 +1104,9 @@ show_symbols_posix (Elf *elf, const GElf
|
||||
/* If we have to precede the line with the file name. */
|
||||
if (print_file_name)
|
||||
{
|
||||
- fputs_unlocked (fullname, stdout);
|
||||
- putchar_unlocked (':');
|
||||
- putchar_unlocked (' ');
|
||||
+ fputs (fullname, stdout);
|
||||
+ putchar (':');
|
||||
+ putchar (' ');
|
||||
}
|
||||
|
||||
printf ("%s %c%s", symstr,
|
||||
--- a/src/objdump.c
|
||||
+++ b/src/objdump.c
|
||||
@@ -580,12 +580,12 @@ show_full_content (Ebl *ebl, const char
|
||||
printf ("%02hhx%02hhx%02hhx%02hhx ",
|
||||
cp[inner], cp[inner + 1], cp[inner + 2],
|
||||
cp[inner + 3]);
|
||||
- fputc_unlocked (' ', stdout);
|
||||
+ fputc (' ', stdout);
|
||||
|
||||
for (size_t inner = 0; inner < 16; ++inner)
|
||||
- fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner])
|
||||
+ fputc (isascii (cp[inner]) && isprint (cp[inner])
|
||||
? cp[inner] : '.', stdout);
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
printf (" %04zx ", cnt);
|
||||
@@ -601,14 +601,14 @@ show_full_content (Ebl *ebl, const char
|
||||
|
||||
for (inner = 2 * (16 - inner) + (16 - inner + 3) / 4 + 1; inner > 0;
|
||||
--inner)
|
||||
- fputc_unlocked (' ', stdout);
|
||||
+ fputc (' ', stdout);
|
||||
|
||||
for (inner = 0; inner < remaining; ++inner)
|
||||
- fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner])
|
||||
+ fputc (isascii (cp[inner]) && isprint (cp[inner])
|
||||
? cp[inner] : '.', stdout);
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,12 +640,12 @@ disasm_output (char *buf, size_t buflen,
|
||||
printf ("%8" PRIx64 ": ", (uint64_t) info->addr);
|
||||
|
||||
if (info->bytes_color != NULL)
|
||||
- fputs_unlocked (info->bytes_color, stdout);
|
||||
+ fputs (info->bytes_color, stdout);
|
||||
size_t cnt;
|
||||
for (cnt = 0; cnt < (size_t) MIN (info->cur - info->last_end, 8); ++cnt)
|
||||
printf (" %02" PRIx8, info->last_end[cnt]);
|
||||
if (info->bytes_color != NULL)
|
||||
- fputs_unlocked (color_off, stdout);
|
||||
+ fputs (color_off, stdout);
|
||||
|
||||
printf ("%*s %.*s\n",
|
||||
(int) (8 - cnt) * 3 + 1, "", (int) buflen, buf);
|
||||
@@ -663,12 +663,12 @@ disasm_output (char *buf, size_t buflen,
|
||||
printf ("%8" PRIx64 ": ", (uint64_t) info->addr);
|
||||
|
||||
if (info->bytes_color != NULL)
|
||||
- fputs_unlocked (info->bytes_color, stdout);
|
||||
+ fputs (info->bytes_color, stdout);
|
||||
for (; cnt < (size_t) (info->cur - info->last_end); ++cnt)
|
||||
printf (" %02" PRIx8, info->last_end[cnt]);
|
||||
if (info->bytes_color != NULL)
|
||||
- fputs_unlocked (color_off, stdout);
|
||||
- putchar_unlocked ('\n');
|
||||
+ fputs (color_off, stdout);
|
||||
+ putchar ('\n');
|
||||
info->addr += info->cur - info->last_end - 8;
|
||||
}
|
||||
|
||||
--- a/src/readelf.c
|
||||
+++ b/src/readelf.c
|
||||
@@ -1127,7 +1127,7 @@ print_file_type (unsigned short int e_ty
|
||||
static void
|
||||
print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
{
|
||||
- fputs_unlocked (_("ELF Header:\n Magic: "), stdout);
|
||||
+ fputs (_("ELF Header:\n Magic: "), stdout);
|
||||
for (size_t cnt = 0; cnt < EI_NIDENT; ++cnt)
|
||||
printf (" %02hhx", ehdr->e_ident[cnt]);
|
||||
|
||||
@@ -1154,7 +1154,7 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
printf (_(" ABI Version: %hhd\n"),
|
||||
ehdr->e_ident[EI_ABIVERSION]);
|
||||
|
||||
- fputs_unlocked (_(" Type: "), stdout);
|
||||
+ fputs (_(" Type: "), stdout);
|
||||
print_file_type (ehdr->e_type);
|
||||
|
||||
const char *machine = dwelf_elf_e_machine_string (ehdr->e_machine);
|
||||
@@ -1196,9 +1196,9 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
printf (_(" (%" PRIu32 " in [0].sh_info)"),
|
||||
(uint32_t) shdr->sh_info);
|
||||
else
|
||||
- fputs_unlocked (_(" ([0] not available)"), stdout);
|
||||
+ fputs (_(" ([0] not available)"), stdout);
|
||||
}
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
printf (_(" Size of section header entries: %" PRId16 " %s\n"),
|
||||
ehdr->e_shentsize, _("(bytes)"));
|
||||
@@ -1213,9 +1213,9 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
printf (_(" (%" PRIu32 " in [0].sh_size)"),
|
||||
(uint32_t) shdr->sh_size);
|
||||
else
|
||||
- fputs_unlocked (_(" ([0] not available)"), stdout);
|
||||
+ fputs (_(" ([0] not available)"), stdout);
|
||||
}
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
if (unlikely (ehdr->e_shstrndx == SHN_XINDEX))
|
||||
{
|
||||
@@ -1406,7 +1406,7 @@ There are %zd section headers, starting
|
||||
}
|
||||
}
|
||||
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -1552,22 +1552,22 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
&& shdr->sh_addr >= relro_from
|
||||
&& shdr->sh_addr + shdr->sh_size <= relro_to)
|
||||
{
|
||||
- fputs_unlocked (" [RELRO:", stdout);
|
||||
+ fputs (" [RELRO:", stdout);
|
||||
in_relro = true;
|
||||
}
|
||||
else if (has_relro && in_relro && shdr->sh_addr >= relro_to)
|
||||
{
|
||||
- fputs_unlocked ("]", stdout);
|
||||
+ fputs ("]", stdout);
|
||||
in_relro = false;
|
||||
}
|
||||
else if (has_relro && in_relro
|
||||
&& shdr->sh_addr + shdr->sh_size > relro_to)
|
||||
- fputs_unlocked ("] <RELRO:", stdout);
|
||||
+ fputs ("] <RELRO:", stdout);
|
||||
else if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_W) == 0)
|
||||
{
|
||||
if (!in_ro)
|
||||
{
|
||||
- fputs_unlocked (" [RO:", stdout);
|
||||
+ fputs (" [RO:", stdout);
|
||||
in_ro = true;
|
||||
}
|
||||
}
|
||||
@@ -1592,12 +1592,12 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
{
|
||||
if ((phdr2->p_flags & PF_W) == 0 && !in_ro)
|
||||
{
|
||||
- fputs_unlocked (" [RO:", stdout);
|
||||
+ fputs (" [RO:", stdout);
|
||||
in_ro = true;
|
||||
}
|
||||
else if ((phdr2->p_flags & PF_W) != 0 && in_ro)
|
||||
{
|
||||
- fputs_unlocked ("]", stdout);
|
||||
+ fputs ("]", stdout);
|
||||
in_ro = false;
|
||||
}
|
||||
}
|
||||
@@ -1610,16 +1610,16 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
|
||||
if (has_relro && in_relro
|
||||
&& shdr->sh_addr + shdr->sh_size > relro_to)
|
||||
{
|
||||
- fputs_unlocked (">", stdout);
|
||||
+ fputs (">", stdout);
|
||||
in_relro = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_relro || in_ro)
|
||||
- fputs_unlocked ("]", stdout);
|
||||
+ fputs ("]", stdout);
|
||||
|
||||
/* Finish the line. */
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1788,8 +1788,8 @@ print_flags (int class, GElf_Xword d_val
|
||||
if (d_val & flags[cnt].mask)
|
||||
{
|
||||
if (!first)
|
||||
- putchar_unlocked (' ');
|
||||
- fputs_unlocked (flags[cnt].str, stdout);
|
||||
+ putchar (' ');
|
||||
+ fputs (flags[cnt].str, stdout);
|
||||
d_val &= ~flags[cnt].mask;
|
||||
first = false;
|
||||
}
|
||||
@@ -1797,11 +1797,11 @@ print_flags (int class, GElf_Xword d_val
|
||||
if (d_val != 0)
|
||||
{
|
||||
if (!first)
|
||||
- putchar_unlocked (' ');
|
||||
+ putchar (' ');
|
||||
printf ("%#0*" PRIx64, class == ELFCLASS32 ? 10 : 18, d_val);
|
||||
}
|
||||
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
|
||||
@@ -1909,7 +1909,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
|
||||
phdr->p_offset);
|
||||
}
|
||||
|
||||
- fputs_unlocked (_(" Type Value\n"), stdout);
|
||||
+ fputs (_(" Type Value\n"), stdout);
|
||||
|
||||
/* if --use-dynamic option is enabled,
|
||||
use the string table to get the related library info. */
|
||||
@@ -1953,7 +1953,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
|
||||
case DT_BIND_NOW:
|
||||
case DT_TEXTREL:
|
||||
/* No further output. */
|
||||
- fputc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
break;
|
||||
|
||||
case DT_NEEDED:
|
||||
@@ -2147,7 +2147,7 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *
|
||||
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
|
||||
shdr->sh_offset,
|
||||
nentries);
|
||||
- fputs_unlocked (class == ELFCLASS32
|
||||
+ fputs (class == ELFCLASS32
|
||||
? _("\
|
||||
Offset Type Value Name\n")
|
||||
: _("\
|
||||
@@ -2384,7 +2384,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr
|
||||
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
|
||||
shdr->sh_offset,
|
||||
nentries);
|
||||
- fputs_unlocked (class == ELFCLASS32
|
||||
+ fputs (class == ELFCLASS32
|
||||
? _("\
|
||||
Offset Type Value Addend Name\n")
|
||||
: _("\
|
||||
@@ -2891,7 +2891,7 @@ process_symtab (Ebl *ebl, unsigned int n
|
||||
}
|
||||
}
|
||||
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2973,7 +2973,7 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
|
||||
(unsigned int) shdr->sh_link,
|
||||
elf_strptr (ebl->elf, shstrndx, glink->sh_name));
|
||||
|
||||
- fputs_unlocked (class == ELFCLASS32
|
||||
+ fputs (class == ELFCLASS32
|
||||
? _("\
|
||||
Num: Value Size Type Bind Vis Ndx Name\n")
|
||||
: _("\
|
||||
@@ -3649,12 +3649,12 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
|
||||
{
|
||||
ssize_t n;
|
||||
case 0:
|
||||
- fputs_unlocked (_(" 0 *local* "),
|
||||
+ fputs (_(" 0 *local* "),
|
||||
stdout);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
- fputs_unlocked (_(" 1 *global* "),
|
||||
+ fputs (_(" 1 *global* "),
|
||||
stdout);
|
||||
break;
|
||||
|
||||
@@ -3671,7 +3671,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
|
||||
break;
|
||||
}
|
||||
}
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
|
||||
@@ -3718,7 +3718,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
|
||||
uint64_t success = 0;
|
||||
|
||||
/* xgettext:no-c-format */
|
||||
- fputs_unlocked (_("\
|
||||
+ fputs (_("\
|
||||
Length Number % of total Coverage\n"), stdout);
|
||||
printf (_(" 0 %6" PRIu32 " %5.1f%%\n"),
|
||||
counts[0], (counts[0] * 100.0) / nbucket);
|
||||
@@ -4140,7 +4140,7 @@ print_attributes (Ebl *ebl, const GElf_E
|
||||
if (unlikely (*p++ != 'A'))
|
||||
return;
|
||||
|
||||
- fputs_unlocked (_(" Owner Size\n"), stdout);
|
||||
+ fputs (_(" Owner Size\n"), stdout);
|
||||
|
||||
/* Loop over the sections. */
|
||||
while (left (data, p) >= 4)
|
||||
@@ -7233,7 +7233,7 @@ print_encoding_base (const char *pfx, un
|
||||
if (w & 0x70)
|
||||
{
|
||||
if (w != fde_encoding)
|
||||
- fputc_unlocked (' ', stdout);
|
||||
+ fputc (' ', stdout);
|
||||
|
||||
w = print_relinfo (w);
|
||||
}
|
||||
@@ -9772,7 +9772,7 @@ print_debug_line_section (Dwfl_Module *d
|
||||
{
|
||||
get_uleb128 (u128, linep, lineendp);
|
||||
if (n != standard_opcode_lengths[opcode])
|
||||
- putc_unlocked (',', stdout);
|
||||
+ fputc (',', stdout);
|
||||
printf (" %u", u128);
|
||||
}
|
||||
|
||||
@@ -10525,7 +10525,7 @@ print_debug_macinfo_section (Dwfl_Module
|
||||
\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"),
|
||||
elf_ndxscn (scn), section_name (ebl, shdr),
|
||||
(uint64_t) shdr->sh_offset);
|
||||
- putc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
/* There is no function in libdw to iterate over the raw content of
|
||||
the section but it is easy enough to do. */
|
||||
@@ -10687,7 +10687,7 @@ print_debug_macro_section (Dwfl_Module *
|
||||
\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"),
|
||||
elf_ndxscn (scn), section_name (ebl, shdr),
|
||||
(uint64_t) shdr->sh_offset);
|
||||
- putc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
/* Get the source file information for all CUs. Uses same
|
||||
datastructure as macinfo. But uses offset field to directly
|
||||
@@ -10840,15 +10840,15 @@ print_debug_macro_section (Dwfl_Module *
|
||||
goto invalid_data;
|
||||
args--;
|
||||
if (args > 0)
|
||||
- putchar_unlocked (',');
|
||||
+ putchar (',');
|
||||
}
|
||||
}
|
||||
else
|
||||
printf (_(" no arguments."));
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
}
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
|
||||
int level = 1;
|
||||
if (readp + 1 > readendp)
|
||||
@@ -11025,14 +11025,14 @@ print_debug_macro_section (Dwfl_Module *
|
||||
if (args > 0)
|
||||
printf (", ");
|
||||
}
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
if (readp + 1 > readendp)
|
||||
goto invalid_data;
|
||||
opcode = *readp++;
|
||||
if (opcode == 0)
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11368,7 +11368,7 @@ print_debug_frame_hdr_section (Dwfl_Modu
|
||||
/* +4 because of the 4 byte header of the section. */
|
||||
(uint64_t) shdr->sh_offset + 4 + eh_frame_ptr);
|
||||
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
uint64_t fde_count = 0;
|
||||
@@ -11546,7 +11546,7 @@ print_debug_exception_table (Dwfl_Module
|
||||
else if (ar_disp != 0)
|
||||
puts (" -> ???");
|
||||
else
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
++u;
|
||||
}
|
||||
while (readp < action_table_end);
|
||||
@@ -13200,19 +13200,19 @@ handle_core_note (Ebl *ebl, const GElf_N
|
||||
nregloc == 0 ? nhdr->n_descsz : 0,
|
||||
items, nitems);
|
||||
if (colno != 0)
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
|
||||
colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
|
||||
reglocs, nregloc);
|
||||
if (colno != 0)
|
||||
- putchar_unlocked ('\n');
|
||||
+ putchar ('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
handle_notes_data (Ebl *ebl, const GElf_Ehdr *ehdr,
|
||||
GElf_Off start, Elf_Data *data)
|
||||
{
|
||||
- fputs_unlocked (_(" Owner Data size Type\n"), stdout);
|
||||
+ fputs (_(" Owner Data size Type\n"), stdout);
|
||||
|
||||
if (data == NULL)
|
||||
goto bad_note;
|
||||
--- a/src/size.c
|
||||
+++ b/src/size.c
|
||||
@@ -411,7 +411,7 @@ show_sysv (Elf *elf, const char *prefix,
|
||||
maxlen = MAX (maxlen, (int) strlen (name));
|
||||
}
|
||||
|
||||
- fputs_unlocked (fname, stdout);
|
||||
+ fputs (fname, stdout);
|
||||
if (prefix != NULL)
|
||||
printf (_(" (ex %s)"), prefix);
|
||||
printf (":\n%-*s %*s %*s\n",
|
||||
@@ -483,7 +483,7 @@ show_sysv_one_line (Elf *elf)
|
||||
continue;
|
||||
|
||||
if (! first)
|
||||
- fputs_unlocked (" + ", stdout);
|
||||
+ fputs (" + ", stdout);
|
||||
first = false;
|
||||
|
||||
printf ((radix == radix_hex ? "%" PRIx64 "(%s)"
|
||||
@@ -555,7 +555,7 @@ show_bsd (Elf *elf, const char *prefix,
|
||||
fname);
|
||||
if (prefix != NULL)
|
||||
printf (_(" (ex %s)"), prefix);
|
||||
- fputs_unlocked ("\n", stdout);
|
||||
+ fputs ("\n", stdout);
|
||||
|
||||
total_textsize += textsize;
|
||||
total_datasize += datasize;
|
||||
@@ -607,7 +607,7 @@ show_segments (Elf *elf, const char *ful
|
||||
continue;
|
||||
|
||||
if (! first)
|
||||
- fputs_unlocked (" + ", stdout);
|
||||
+ fputs (" + ", stdout);
|
||||
first = false;
|
||||
|
||||
printf (radix == radix_hex ? "%" PRIx64 "(%c%c%c)"
|
||||
--- a/src/strings.c
|
||||
+++ b/src/strings.c
|
||||
@@ -345,8 +345,8 @@ process_chunk_mb (const char *fname, con
|
||||
/* We found a match. */
|
||||
if (unlikely (fname != NULL))
|
||||
{
|
||||
- fputs_unlocked (fname, stdout);
|
||||
- fputs_unlocked (": ", stdout);
|
||||
+ fputs (fname, stdout);
|
||||
+ fputs (": ", stdout);
|
||||
}
|
||||
|
||||
if (unlikely (radix != radix_none))
|
||||
@@ -357,7 +357,7 @@ process_chunk_mb (const char *fname, con
|
||||
|
||||
if (unlikely (*unprinted != NULL))
|
||||
{
|
||||
- fputs_unlocked (*unprinted, stdout);
|
||||
+ fputs (*unprinted, stdout);
|
||||
free (*unprinted);
|
||||
*unprinted = NULL;
|
||||
}
|
||||
@@ -366,8 +366,8 @@ process_chunk_mb (const char *fname, con
|
||||
assume the file data is encoded in UCS-2/UTF-16 or
|
||||
UCS-4/UTF-32 respectively we could convert the string.
|
||||
But there is no such guarantee. */
|
||||
- fwrite_unlocked (start, 1, buf - start, stdout);
|
||||
- putc_unlocked ('\n', stdout);
|
||||
+ fwrite (start, 1, buf - start, stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
start = ++buf;
|
||||
@@ -413,8 +413,8 @@ process_chunk (const char *fname, const
|
||||
/* We found a match. */
|
||||
if (likely (fname != NULL))
|
||||
{
|
||||
- fputs_unlocked (fname, stdout);
|
||||
- fputs_unlocked (": ", stdout);
|
||||
+ fputs (fname, stdout);
|
||||
+ fputs (": ", stdout);
|
||||
}
|
||||
|
||||
if (likely (radix != radix_none))
|
||||
@@ -425,12 +425,12 @@ process_chunk (const char *fname, const
|
||||
|
||||
if (unlikely (*unprinted != NULL))
|
||||
{
|
||||
- fputs_unlocked (*unprinted, stdout);
|
||||
+ fputs (*unprinted, stdout);
|
||||
free (*unprinted);
|
||||
*unprinted = NULL;
|
||||
}
|
||||
- fwrite_unlocked (start, 1, buf - start, stdout);
|
||||
- putc_unlocked ('\n', stdout);
|
||||
+ fwrite (start, 1, buf - start, stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
start = ++buf;
|
||||
--- a/tests/showptable.c
|
||||
+++ b/tests/showptable.c
|
||||
@@ -111,11 +111,11 @@ main (int argc, char *argv[])
|
||||
(unsigned long long int) phdr->p_memsz,
|
||||
(unsigned long long int) phdr->p_align);
|
||||
|
||||
- putc_unlocked ((phdr->p_flags & PF_X) ? 'X' : ' ', stdout);
|
||||
- putc_unlocked ((phdr->p_flags & PF_W) ? 'W' : ' ', stdout);
|
||||
- putc_unlocked ((phdr->p_flags & PF_R) ? 'R' : ' ', stdout);
|
||||
+ fputc ((phdr->p_flags & PF_X) ? 'X' : ' ', stdout);
|
||||
+ fputc ((phdr->p_flags & PF_W) ? 'W' : ' ', stdout);
|
||||
+ fputc ((phdr->p_flags & PF_R) ? 'R' : ' ', stdout);
|
||||
|
||||
- putc_unlocked ('\n', stdout);
|
||||
+ fputc ('\n', stdout);
|
||||
|
||||
if (phdr->p_type == PT_INTERP)
|
||||
{
|
|
@ -23,7 +23,7 @@
|
|||
# Only available since automake 1.12
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_CHECK_TOOL([READELF], [readelf])
|
||||
@@ -635,6 +639,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
@@ -646,6 +650,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
CFLAGS="$old_CFLAGS"])
|
||||
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
|
||||
|
||||
|
@ -34,9 +34,9 @@
|
|||
LIBS="$saved_LIBS"
|
||||
--- a/lib/eu-config.h
|
||||
+++ b/lib/eu-config.h
|
||||
@@ -59,14 +59,19 @@
|
||||
# define once(once_control, init_routine) init_routine()
|
||||
#endif /* USE_LOCKS */
|
||||
@@ -31,14 +31,19 @@
|
||||
|
||||
#include "locks.h"
|
||||
|
||||
-#include <libintl.h>
|
||||
+#include <gettext.h>
|
||||
|
@ -55,7 +55,7 @@
|
|||
|
||||
#ifdef __i386__
|
||||
# define internal_function __attribute__ ((regparm (3), stdcall))
|
||||
@@ -77,7 +82,7 @@
|
||||
@@ -49,7 +54,7 @@
|
||||
#define internal_strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
|||
#define attribute_hidden \
|
||||
__attribute__ ((visibility ("hidden")))
|
||||
#else
|
||||
@@ -166,7 +171,7 @@ asm (".section predict_data, \"aw\"; .pr
|
||||
@@ -138,7 +143,7 @@ asm (".section predict_data, \"aw\"; .pr
|
||||
#endif
|
||||
|
||||
/* Avoid PLT entries. */
|
||||
|
@ -203,7 +203,7 @@
|
|||
+#include <libeu.h>
|
||||
#include <libdw.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#include "eu-search.h"
|
||||
--- a/config/libdebuginfod.pc.in
|
||||
+++ b/config/libdebuginfod.pc.in
|
||||
@@ -8,5 +8,5 @@ Description: elfutils library to query d
|
||||
|
@ -237,7 +237,7 @@
|
|||
Requires.private: zlib @LIBZSTD@
|
||||
--- a/libebl/eblopenbackend.c
|
||||
+++ b/libebl/eblopenbackend.c
|
||||
@@ -200,8 +200,6 @@ static bool default_object_note (const c
|
||||
@@ -202,8 +202,6 @@ static bool default_object_note (const c
|
||||
uint32_t descsz, const char *desc);
|
||||
static bool default_debugscn_p (const char *name);
|
||||
static bool default_copy_reloc_p (int reloc);
|
||||
|
@ -246,7 +246,7 @@
|
|||
static bool default_check_special_symbol (Elf *elf,
|
||||
const GElf_Sym *sym,
|
||||
const char *name,
|
||||
@@ -253,8 +251,8 @@ fill_defaults (Ebl *result)
|
||||
@@ -255,8 +253,8 @@ fill_defaults (Ebl *result)
|
||||
result->object_note = default_object_note;
|
||||
result->debugscn_p = default_debugscn_p;
|
||||
result->copy_reloc_p = default_copy_reloc_p;
|
||||
|
@ -257,7 +257,7 @@
|
|||
result->check_special_symbol = default_check_special_symbol;
|
||||
result->data_marker_symbol = default_data_marker_symbol;
|
||||
result->check_st_other_bits = default_check_st_other_bits;
|
||||
@@ -636,8 +634,6 @@ default_copy_reloc_p (int reloc __attrib
|
||||
@@ -638,8 +636,6 @@ default_copy_reloc_p (int reloc __attrib
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
|
||||
ac_cv_visibility, [dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
@@ -419,7 +421,10 @@ AS_HELP_STRING([--enable-install-elfh],[
|
||||
@@ -423,7 +425,10 @@ AS_HELP_STRING([--enable-install-elfh],[
|
||||
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
|
||||
|
||||
AM_CONDITIONAL(BUILD_STATIC, [dnl
|
||||
|
@ -132,7 +132,7 @@
|
|||
|
||||
libdebuginfod_a_SOURCES = debuginfod-client.c
|
||||
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
|
||||
@@ -111,12 +113,16 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
|
||||
@@ -111,12 +113,17 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
|
||||
libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs $< $@
|
||||
|
||||
|
@ -146,9 +146,10 @@
|
|||
+else
|
||||
+libdebuginfod_a_LIBADD = $(foreach dep,$(wildcard $(libdebuginfod_so_LDLIBS:.so=.a)) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
+
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -50,7 +50,7 @@ check_PROGRAMS = arextract arsymtest new
|
||||
|
@ -158,9 +159,9 @@
|
|||
- buildid deleted deleted-lib.so aggregate_size peel_type \
|
||||
+ buildid aggregate_size peel_type \
|
||||
vdsosyms \
|
||||
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
|
||||
elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr \
|
||||
@@ -180,7 +180,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
getsrc_die strptr newdata newzdata \
|
||||
elfstrtab dwfl-proc-attach \
|
||||
@@ -181,7 +181,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
run-readelf-addr.sh run-readelf-str.sh \
|
||||
run-readelf-multi-noline.sh \
|
||||
run-readelf-types.sh \
|
||||
|
@ -168,10 +169,10 @@
|
|||
+ run-readelf-dwz-multi.sh run-allfcts-multi.sh \
|
||||
run-linkmap-cut.sh run-aggregate-size.sh run-peel-type.sh \
|
||||
vdsosyms run-readelf-A.sh \
|
||||
run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
|
||||
@@ -284,6 +284,11 @@ funcretval_test__11_SOURCES = funcretval
|
||||
TESTS += run-funcretval++11.sh
|
||||
endif
|
||||
run-getsrc-die.sh run-strptr.sh newdata newzdata \
|
||||
@@ -298,6 +298,11 @@ check_PROGRAMS += funcretval_test_struct
|
||||
funcretval_test_struct_SOURCES = funcretval_test_struct.c
|
||||
TESTS += run-funcretval-struct-native.sh
|
||||
|
||||
+if BUILD_SHARED
|
||||
+check_PROGRAMS += deleted deleted-lib.so
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
|
||||
--- a/libdwfl/Makefile.am
|
||||
+++ b/libdwfl/Makefile.am
|
||||
@@ -93,4 +93,10 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_S
|
||||
@@ -94,4 +94,10 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_S
|
||||
|
||||
noinst_HEADERS = libdwflP.h
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
+MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS) $(EXTRA_libebl_a_DEPENDENCIES)
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -119,4 +119,9 @@ am_libebl_backends_pic_a_OBJECTS = $(lib
|
||||
@@ -122,4 +122,9 @@ am_libebl_backends_pic_a_OBJECTS = $(lib
|
||||
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
||||
EXTRA_DIST = $(modules:=_reloc.def)
|
||||
|
||||
|
@ -119,9 +119,9 @@
|
|||
CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -41,3 +41,10 @@ noinst_HEADERS = fixedsizehash.h libeu.h
|
||||
eu-config.h color.h printversion.h bpf.h \
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h
|
||||
@@ -42,3 +42,10 @@ noinst_HEADERS = fixedsizehash.h libeu.h
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h \
|
||||
eu-search.h locks.h
|
||||
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
|
||||
+
|
||||
+EXTRA_libeu_a_DEPENDENCIES = libeu.manifest
|
||||
|
|
Loading…
Reference in New Issue