| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Add the NT_ARM_PAC_MASK and NT_ARM_PAC_ENABLED_KEYS for aarch64.
Recognize and print the new core item.
Signed-off-by: Kuan-Ying Lee <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
We need to read the PAC mask from a core file when debugging offline
as the information is still needed to demangle return addresses.
This commit pulls out the NT_ARM_PAC_MASK info from the core and feeds
it through to dwfl_thread_state_registers for each thread.
Signed-off-by: Steve Capper <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On AArch64 systems with pointer authentication enabled, one needs to
know the PAC mask in order to unwind functions that employ PAC.
This patch extends dwfl_thread_state_registers to handle the PAC mask
information by introducing a special register -2. (-1 is used in a
similar manner already for handling the program counter).
The AArch64 linux process attach logic is also extended to query ptrace
for the PAC mask.
A subsequent patch will add support for retrieving the PAC mask from an
AArch64 linux core file.
Signed-off-by: Steve Capper <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
This register will be used to indicate whether a return address is
mangled with a PAC or not, in accordance with the DWARF AARCH64 ABI [1].
[1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#41dwarf-register-names
Signed-off-by: German Gomez <[email protected]>
[SteveC: move DW_AARCH64_RA_SIGN_STATE to cfi.h, fix comments]
Signed-off-by: Steve Capper <[email protected]>
|
| |
|
|
|
|
|
| |
Add the NT_ARM_TAGGED_ADDR_CTRL regset for aarch64.
Recognize and print this new core itme.
Signed-off-by: Kuan-Ying Lee <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
None of these relocations were ever part of any object file. The
GNU_VTINHERIT and GNU_VTINHERIT relocations were part of the obsolete
--gc-sections support which was never implemented for RISC-V. The other
relocations are only used internally by libbfd during the relaxation pass
and eliminated before writing the object file.
* riscv_reloc.def: Remove GNU_VTINHERIT, GNU_VTENTRY, RVC_LUI,
GPREL_I, GPREL_S, TPREL_I, TPREL_S.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`gcc-15` added a new warning in https://gcc.gnu.org/PR115185:
i386_regs.c:88:11: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
88 | "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
| ^~~~
`elfutils` does not need to store '\0'. We could either initialize the
arrays with individual bytes or allocate extra byte for null.
This change initializes the array bytewise.
* backends/i386_regs.c (i386_register_info): Initialize the
array bytewise to fix gcc-15 warning.
* backends/x86_64_regs.c (x86_64_register_info): Ditto.
Signed-off-by: Sergei Trofimovich <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the "invalid machine flag" error from eu-elflint when passing
hexagon binaries.
* backends/hexagon_init.c (hexagon_init): Hook
machine_flag_check
* backends/hexagon_symbol.c (hexagon_machine_flag_check):
new function
* libelf/elf-knowledge.h: add EF_HEXAGON_TINY constant
Signed-off-by: Matheus Tavares Bernardino <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements initial support for the Hexagon architecture. The
Hexagon ABI spec can be seen at
https://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/21516a52/attachment-0001.pdf
A hello_hexagon.ko test is also added.
$ head tests/test-suite.log
[...]
# TOTAL: 275
# PASS: 269
# SKIP: 6
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
$ cat tests/run-strip-reloc-ko.sh.log
[...]
runtest hello_hexagon.ko
PASS run-strip-reloc-ko.sh (exit status: 0)
* backends/Makefile.am (modules): Add hexagon.
(hexagon_SRCS): New var for hexagon_init.c and hexagon_symbol.c.
(libebl_backends_a_SOURCES): Add hexagon_SRCS.
* backends/hexagon_init.c: New file.
* backends/hexagon_reloc.def: Likewise.
* backends/hexagon_symbol.c: Likewise.
* libebl/eblopenbackend.c (hexagon_init): Declare.
(machines): Add hexagon.
* libelf/elf-knowledge.h: Add hexagon e_flags values, section
indices and and relocs.
* src/elflint.c (valid_e_machine): Add EM_QDSP6.
* tests/Makefile.am (EXTRA_DIST): Add hello_hexagon.ko.bz2.
* tests/hello_hexagon.ko.bz2: New test file.
* tests/run-strip-reloc-ko.sh: Add hello_hexagon.ko.
Signed-off-by: Matheus Tavares Bernardino <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dwfl_module_return_value_location would fail on riscv for functions
which return a (small) struct. This patch implements the simplest
cases of flatten_aggregate in backends/riscv_retval.c. It just handles
structs containing one or two members of the same base type which fit
completely or in pieces in one or two general or floating point
registers.
It also adds a specific test case run-funcretval-struct.sh containing
small structs of ints, longs, floats and doubles. All these testscases
now work for riscv. There is already a slightly more extensive
testcase for this in tests/run-funcretval.sh but that only has a
testcase for aarch64.
* backends/riscv_retval.c (flatten_aggregate_arg): Implement
for the simple cases where we have a struct with one or two
members of the same base type.
(pass_by_flattened_arg): Likewise. Call either
pass_in_gpr_lp64 or pass_in_fpr_lp64d.
(riscv_return_value_location_lp64ifd): Call
flatten_aggregate_arg including size.
* tests/Makefile.am (TESTS): Add run-funcretval-struct.sh
and run-funcretval-struct-native.sh.
(check_PROGRAMS): Add funcretval_test_struct.
(funcretval_test_struct_SOURCES): New.
(EXTRA_DIST): Add run-funcretval-struct.sh,
funcretval_test_struct_riscv.bz2 and
run-funcretval-struct-native.sh.
* tests/funcretval_test_struct_riscv.bz2: New test binary.
* tests/run-funcretval-struct-native.sh: New test.
* tests/run-funcretval-struct.sh: Likewise.
https://sourceware.org/bugzilla/show_bug.cgi?id=31142
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Xi Ruoyao <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
arm_machine_flag_name checks the version byte and if not zero returns
a version string. There are only 5 versions defined. So check the
version byte is not larger.
* backends/arm_machineflagname.c (arm_machine_flag_name):
Check version <= 0, otherwise return NULL.
https://sourceware.org/bugzilla/show_bug.cgi?id=31058
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
* backends/loongarch_reloc.def: Add DELETE, ALIGN, PCREL20_S2,
CFA, ADD6, SUB6, ADD_ULEB128, SUB_ULEB128, 64_PCREL.
Signed-off-by: Xi Ruoyao <[email protected]>
|
| |
|
|
|
|
|
| |
* backends/riscv_reloc.def: Add IRELATIVE, PLT32, SET_ULEB128,
SUB_ULEB128.
Signed-off-by: Andreas Schwab <[email protected]>
|
| |
|
|
|
|
|
| |
This patch implements the set_initial_registers_tid hook for LoongArch.
Signed-off-by: Liwei Ge <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
| |
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
If we don't find any debug information for a given frame, we usually
cannot unwind any further. However, the binary in question might have
been compiled with frame pointers, in which case we can look up the
well known frame pointer locations in the stack snapshot and use them
to bridge the frames without debug information.
Signed-off-by: Liwei Ge <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
|
|
| |
LoongArch ELF ABI specification - Return values:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_return_values
Signed-off-by: Liwei Ge <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
LoongArch Reference Manual - Volume 1:
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
LoongArch ELF ABI:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
Signed-off-by: Liwei Ge <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
Calling dwarf_peeled_die_type with a NULL results pointer is an error,
check early that result is not NULL so dwarf_formref_die and
dwarf_peel_type won't try to set the NULL Dwarf_Die.
* backends/libebl_CPU.h (dwarf_peeled_die_type): Move check
for results == NULL to start of function.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add handling of _GLOBAL_OFFSET_TABLE_.
Before applying the patch:
$ ./src/elflint --gnu-ld ./src/elflint
section [35] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x68548
does not match .got.plt section address 0x68238
After applying the patch:
$ ./src/elflint --gnu-ld ./src/elflint
No errors
Signed-off-by: Liwei Ge <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
| |
Add new relocation type handling.
Signed-off-by: Youling Tang <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch I can use eu-elflint to verify LoongArch ELF
binaries. Previously eu-elflint was complaining about invalid
machine flags:
$ ./src/elflint --gnu-ld ./src/elflint
invalid machine flags: 0x43
$ echo $?
1
* backends/loongarch_symbol.c (loongarch_init): Hook
machine_flag_check.
* backends/loongarch_symbol.c (loongarch_machine_flag_check):
New function.
https://sourceware.org/bugzilla/show_bug.cgi?id=30251
Signed-off-by: Alexey Sheplyakov <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
binutils 2.40 introduces DW_TAG_unspecified_type for assembly
functions with an unknown return type. This breaks the
run-funcretval.sh testcase because dwfl_module_return_value_location
returns an error for such functions because it cannot determine the
return value location. Fix that by treating DW_TAG_unspecified_type
as if the DIE doesn't have a DW_AT_type.
Also update the testcase to explicitly checking for
DW_TAG_unspecified_type and printing "returns unspecified type".
https://sourceware.org/bugzilla/show_bug.cgi?id=30047
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
On the low level, they are the same as pointers. The change needs to be
done for all backends, so define a function and a macro to avoid
repetition. Also add a native test, which has to be implemented in C++.
Add the configure check for it.
Signed-off-by: Ilya Leoshkevich <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MSan complains:
Uninitialized value was created by an allocation of 'reglocs' in the stack frame
#0 0x562d35c686f0 in handle_core_note elfutils/src/readelf.c:12674:3
#const Ebl_Register_Location *reglocs;
==1006199==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x562d35c68a2a in handle_core_note elfutils/src/readelf.c:12692:11
#colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
# reglocs, nregloc);
Strictly speaking, this is not a problem, because nregloc == 0, but for
other note types we initialize it anyway, so do it here as well.
Signed-off-by: Ilya Leoshkevich <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Using the NONE relocation doesn't do anything, but is harmless.
This fixes several (self) tests on sparc that use elflint to
check files are valid ELF.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no regression in tests for an x86_64 build, while the new
hello_arc_hs4.ko is added as well. This is the only meaningful
test that I could add at the moment, given the features supported
by this port.
$ cat tests/test-suite.log
==========================================
elfutils 0.188: tests/test-suite.log
==========================================
# TOTAL: 236
# PASS: 235
# SKIP: 1
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
SKIP: run-lfs-symbols.sh
========================
LFS testing is irrelevant on this system
SKIP run-lfs-symbols.sh (exit status: 77)
$ cat tests/run-strip-reloc.sh.log
runtest hello_i386.ko
runtest hello_x86_64.ko
runtest hello_ppc64.ko
runtest hello_s390.ko
runtest hello_aarch64.ko
runtest hello_m68k.ko
runtest hello_riscv64.ko
runtest hello_csky.ko
runtest hello_arc_hs4.ko <-- [ new ARC HS4 test ]
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip.o
runtest strip-uncompressed.o
runtest strip-compressed.o
runtest testfile-debug-rel-ppc64.o
runtest testfile-debug-rel-ppc64-z.o
runtest testfile-debug-rel-ppc64-g.o
PASS run-strip-reloc.sh (exit status: 0)
Signed-off-by: Shahab Vahedi <[email protected]>
|
| |
|
|
|
|
| |
This implements initial support for the LoongArch architecture.
Signed-off-by: Hengqi Chen <[email protected]>
|
| |
|
|
|
|
| |
Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC.
Signed-off-by: Andreas Schwab <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Arm needs to decode flags and I modeled it after the binutils code.
The same messages are printed. Given the requirement of the interface
and the ABIs the current version of the callback function isn't
sufficient unless one wants to create a stateful interface. The
problem is that most flags need to be interpreted in the context of
the ABI version. So I changed the API to also pass the original flag
value. This shouldn't be a problem because there are no users yet.
There is also a bug in ebl_machine_flag_name. When copying the string
provided by the callback cp is moved past the NUL byte. It should
move to the NUL byte. Otherwise one cannot anything but the first
added flag description. Finally some cosmetic changes (space after
each comma in the output).
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code in ppc_initreg.c used PTRACE_PEEKUSER to fetch all registers
one by one. Which is slightly inefficient. It did this because it wanted
things to work on linux 2.6.18 which didn't support PTRACE_GETREGSET.
PTRACE_GETREGSET was only officially since 2.6.34 (but backported
to some earlier versions). It seems ok to require a linux kernel that
supports PTRACE_GETREGSET now. This is much more efficient since it
takes just one ptrace call instead of 44 calls to fetch each register
individually.
For some really old versions we need to include <linux/ptrace.h> to
get PTRACE_GETREGSET defined. And on ppc64 there is no 32bit version
of struct pt_regs available, so we define that ourselves and check
how much data is returned to know whether this is a full pt_regs or
one for a 32bit process. An alternative would be to use the raw
iov_base bytes with 64bit or 32bit offset constants to get at the
registers instead of using a struct with names.
The code works for inspecting a 32bit process from a 64bit build,
but not the other way around (the previous code also didn't). This
could work if we also defined and used a 64bit pt_regs struct on
ppc32. But it seems a use case that is not really used (it was hard
enough finding ppc32 setups to test this on).
Tested against ppc and ppc64 on linux 2.6.32 and glibc 2.12 and
ppc and ppc64 on linux 3.10.0 with glibc 2.17.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The RISC-V Linux kernel is compiled without floating point (the LP64
ABI) and elfutils could not obtain return value locations for
functions in the kernel. This issue was noticed when Systemtap
generated RISC-V kernel modules for scripts that used $return target
variables in function return probes. This patch adds the needed
support to provide return value information for the LP64 and LP64F
ABIs.
Signed-off-by: William Cohen <[email protected]>
|
| |
|
|
|
|
|
| |
New function in system.h that returns true if a string has a given
prefix, false otherwise. Use it in place of strncmp.
Signed-off-by: Martin Liška <[email protected]>
|
| |
|
|
|
|
|
| |
Necessary on musl for struct pt_regs definition, doesn't affect the
build on glibc, since <sys/user.h> includes the same header.
Signed-off-by: Érico Rolim <[email protected]>
|
| |
|
|
|
|
|
| |
adress -> address
sigle -> single
Signed-off-by: Dmitry V. Levin <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
The x86_64 abi defines a special section type for .eh_frame[_hdr],
SHT_X86_64_UNWIND, which is a valid relocation target type.
https://sourceware.org/bugzilla/show_bug.cgi?id=26878
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
Support for the Tilera TILE-Gx processor has been removed or deprecated
in gcc and binutils already. There are no users and there is no way to
test it.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
GCC11 -Warray-parameter warned about ebl_syscall_abi being inconsistently
declared (once with a pointer to int, once with an array of 6 int elements).
Since ebl_syscall_abi isn't actually used and was only implemented for
3 backends without any tests just remove it.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
We are using the reloc_nametable zero element as an char array.
So make that element an actual array (we are actually after one
of the next string arrays in the table).
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to do several sanity checks when the ebl backend libraries
were loaded to make sure there was no version mismatch. When initializing
the backend we passed the current Ebl struct size so the library could
check it supported the given Ebl struct and we checked that the init
method returned the correct build time module version string. Neither
are necessary now that the backends are builtin.
Remove both the struct size check and the MODVERSION string (which
wasn't actually checked anymore). Make the init function return the
given Ebl handle or NULL on error (no init function currently indicates
any error).
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Currently, architecture-specific code for libebl exists in separate
libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime.
This makes it impossible to have standalone, statically-linked binaries
which use libdwfl if they depend on any architecture-specific
functionality. Additionally, when these libraries cannot be found, the
failure modes are non-obvious. So, let's get rid of libebl_$arch.so and
move it all into libdw.so/libdw.a, which simplifies things considerably.
Signed-off-by: Omar Sandoval <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Currently, libcpu and libebl are always compiled as PIC. An upcoming
change will add the objects from libcpu.a and libebl.a to libdw.a, which
should not be PIC unless configured that way. So, make libcpu.a and
libebl.a non-PIC and add libcpu_pic.a and libebl_pic.a.
Signed-off-by: Omar Sandoval <[email protected]>
|
| |
|
|
|
|
|
| |
In preparation for combining the libebl backend modules, combine all of
the libcpu backends into libcpu.a.
Signed-off-by: Omar Sandoval <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
C-SKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
C-SKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf
Signed-off-by: Mao Han <[email protected]>
|