| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
Avoid "implicit declaration" compile errors on non-x86_64/i386 arches
by calling x86_sample_* functions only when x86_initreg_sample.c is
included in the build.
Signed-off-by: Aaron Merey <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a generic dwflst_sample_getframes() API that does not
depend on perf_events concepts, in particular the
linux-kernel-specific enum defining the perf_regs_mask register order.
This involves reworking the register-handling backend to use
regs_mapping arrays rather than perf_regs_mask, and provide a way to
translate perf_regs_mask to regs_mapping.
A regs_mapping array, for each item in a provided regs[] array,
specifies its position in the full register file expected by the DWARF
functionality.
* libdwfl_stacktrace/Makefile.am: Rename dwflst_sample_frame.c from
dwflst_perf_frame.c.
* libdwfl_stacktrace/libdwfl_stacktrace.h (dwflst_sample_getframes):
New function providing unwinding functionality with a regs_mapping
array rather than a linux-kernel-dependent perf_regs_mask.
* libdw/libdw.map (ELFUTILS_0.194_EXPERIMENTAL): Add dwflst_sample_getframes.
* libdwfl_stacktrace/dwflst_sample_frame.c: Renamed from
dwflst_perf_frame.c. Remove linux/perf_event.h dependency.
(struct sample_info): Rename from perf_sample_info, include
regs_mapping field, replace abi with elfclass field.
(sample_next_thread): Renamed struct sample_info.
(sample_getthread): Renamed struct sample_info.
(copy_word): Use elfclass instead of perf abi field.
(elf_memory_read): Renamed struct sample_info, use elfclass.
(sample_memory_read): Renamed struct sample_info, use elfclass.
(sample_set_initial_registers): Renamed struct sample_info,
pass regs_mapping to ebl_set_initial_registers_sample.
(dwflst_sample_getframes): New function.
(dwflst_perf_sample_getframes): Reimplement in terms of
dwflst_sample_getframes and ebl_sample_perf_regs_mapping.
* libebl/ebl-hooks.h (set_initial_registers_sample): Now
takes regs_mapping instead of regs_mask.
(sample_base_addr): Removed.
(sample_pc): Removed.
(sample_sp_pc): New function combining the removed functions for
efficiency.
(sample_perf_regs_mapping): New function translating
perf_regs_mask to regs_mapping array.
* libebl/eblinitreg_sample.c (ebl_sample_base_addr): Removed.
(ebl_sample_pc): Removed.
(ebl_sample_sp_pc): New function.
(ebl_set_initial_registers_sample): Take regs_mapping, provide
a default implementation for contiguous dwarf_regs array.
(ebl_sample_perf_regs_mapping): New function.
* libebl/eblclosebackend.c (ebl_closebackend):
Free cached_regs_mapping.
* libebl/libebl.h (ebl_set_initial_registers_sample): Now takes
regs_mapping instead of regs_mask.
(ebl_sample_base_addr): Removed.
(ebl_sample_pc): Removed.
(ebl_sample_sp_pc): New function.
(ebl_sample_perf_regs_mapping): New function.
* libebl/libeblP.h (struct ebl): Add caching fields to remove the
need to repeat a sample_perf_regs_mapping() computation for
every frame when the perf_regs_mask is consistent.
* backends/Makefile.am: Remove no-longer-needed linux-perf-regs.c.
* backends/i386_init.c (i386_init): Renamed sample_* functions,
added cached_regs_mapping and related fields/functions.
* backends/i386_initreg_sample.c (i386_sample_base_addr): Removed.
(i386_sample_pc): Removed.
(i386_sample_sp_pc): New function combining the removed functions.
(i386_set_initial_registers_sample): Removed.
(i386_sample_perf_regs_mapping): New function translating
perf_regs_mask to regs_mapping array.
* backends/linux-perf-regs.c: Removed as perf_sample_find_reg is no
longer needed.
* backends/x86_64_init.c (x86_64_init): Renamed sample_* functions,
added cached_regs_mapping and related fields/functions.
* backends/x86_64_initreg_sample.c (x86_64_sample_base_addr): Removed.
(x86_64_sample_pc): Removed.
(x86_64_sample_sp_pc): New function combining the removed functions.
(x86_64_set_initial_registers_sample): Removed.
(x86_64_sample_perf_regs_mapping): New function translating
perf_regs_mask to regs_mapping array.
* backends/x86_initreg_sample.c (x86_set_initial_registers_sample):
Removed.
(x86_sample_sp_pc): New function.
(x86_sample_perf_regs_mapping): New function translating
perf_regs_mask to regs_mapping array.
Signed-off-by: Serhei Makarov <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When an explicit type of long double is specified in the ELF
GNU_Power_ABI_FP attribute, elflint and friends were erroring out:
section [36] '.gnu.attributes': offset 15: unrecognized GNU_Power_ABI_FP attribute value 9
Add the different long double tags to fp_kinds so that these values
are correctly recognised and printed.
Signed-off-by: A. Wilcox <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
asm/perf_regs.h is an arch-specific linux include, not present on
architectures like hppa and m68k that lack perf_events support.
Only one place we need to fix; others already guard the include by
architecture, or use architecture-independent headers (e.g.
linux/perf_events.h).
* backends/libebl_PERF_FLAGS.h: Only include asm/perf_regs.h on
architectures where we use it.
Signed-off-by: Serhei Makarov <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First patch of a series that reworks eu-stacktrace functionality
into a library interface for other profiling tools.
* * *
As it happens, Linux perf_events and DWARF can prescribe completely
different layouts for the register file, requiring non-obvious code
for translation. This makes sense to put in libebl if we want
profilers to handle perf sample data with elfutils.
Start with the x86_64/i386 implementation taken from eu-stacktrace. The
code has been generalized to accept other perf register masks besides
the 'preferred' one.
* backends/Makefile.am (i386_SRCS): Add i386_initreg_sample.c.
(x86_64_SRCS): Add x86_64_initreg_sample.c.
(noinst_HEADERS): Add libebl_PERF_FLAGS.h,
linux-perf-regs.c, x86_initreg_sample.c.
* backends/libebl_PERF_FLAGS.h: New file.
* backends/linux-perf-regs.c: New file.
(perf_sample_find_reg): Index into a perf register array whose
contents are described by regs_mask. The target index is the index
of the register in the enum defined by
linux arch/N/include/uapi/asm/perf_regs.h on arch N.
* backends/x86_initreg_sample.c: New file, implements a generalized
version of the eu-stacktrace register shuffling for x86-64/i386.
* backends/x86_64_initreg_sample.c: New file, specializes
x86_initreg_sample.c for x86-64.
* backends/i386_initreg_sample.c: New file, specializes
i386_initreg_sample.c for i386.
* backends/x86_64_init.c (x86_64_init): Add initialization for
set_initial_registers_sample, perf_frame_regs_mask,
sample_base_addr, sample_pc.
* backends/i386_init.c (i386_init): Add initialization for
set_initial_registers_sample, perf_frame_regs_mask,
sample_base_addr, sample_pc.
* libebl/Makefile.am (libebl_a_SOURCES): Add eblinitreg_sample.c.
* libebl/ebl-hooks.h (set_initial_registers_sample): New hook.
(sample_base_addr): Ditto.
(sample_pc): Ditto.
* libebl/eblinitreg_sample.c: New file, implements ebl interface to
set_initial_registers_sample, sample_base_addr, sample_pc
backend hooks.
* libebl/libebl.h (ebl_set_initial_registers_sample): New function.
(ebl_perf_frame_regs_mask): New function.
(ebl_sample_base_addr): New function.
(ebl_sample_pc): New function.
* libebl/libeblP.h (struct ebl): Add perf_frame_regs_mask field
giving the preferred register mask.
Signed-off-by: Serhei Makarov <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Aarch64, Linux is using Pointer Authentication Code (PAC) for pointer
authentication.[1] The struct "user_pac_mask" has been part of the Linux
kernel since version 5.0 as part of this feature. However, older kernels
do not define it.
Therefore, we want to check if the definition is present in the kernel
headers and provide one if it isn't. This ensures two things:
* elfutils will continue to compile against kernel headers from 4.x
* binaries built against older kernel headers will still be fully
functional if used on a newer system
For reference, the build error that is being avoided looks like this:
[...]
CC aarch64_initreg.o
aarch64_initreg.c: In function 'aarch64_set_initial_registers_tid':
aarch64_initreg.c:61:24: error: storage size of 'pac_mask' isn't known
struct user_pac_mask pac_mask;
^~~~~~~~
aarch64_initreg.c:61:24: warning: unused variable 'pac_mask' [-Wunused-variable]
make[4]: *** [Makefile:831: aarch64_initreg.o] Error 1
make[3]: *** [Makefile:547: all-recursive] Error 1
make[2]: *** [Makefile:463: all] Error 2
[1] https://docs.kernel.org/arch/arm64/pointer-authentication.html
https://sourceware.org/bugzilla/show_bug.cgi?id=32684
Fixes: 64e3b451ad2c ("aarch64: extend dwfl_thread_state_registers to handle PAC")
Signed-off-by: Markus Mayer <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ar program is called to assemble a list of objects
within each archive to assist in building combined libraries,
however make already has this information
when processing the subdirectory for that respective library.
The list can be saved in a "manifest" file
instead of being generated whenever it is needed
for use with other subdirectories.
Even though the difference in time is insignificant,
a simple "echo" and "cat" is as much as 10 times faster
than a call to "ar t" for printing the archive members.
Since elfutils builds ar,
this also removes the awkward circular dependency
where an installation of ar is required
to build the libraries for ar.
Additionally, not every version of ar is equally portable,
as native versions of ar on macOS and other BSD-like distributions
may print out a special archive member like "__.SYMDEF"
which is not a compiled object but rather just metadata
from ranlib, leading to a build failure.
Avoid these limitations by removing usage of ar
and adding build and clean rules
for the usage of archive manifest files.
* .gitignore: exclude ".manifest" file extension.
* backends/Makefile.am: add manifest file build and clean rules.
* debuginfod/Makefile.am: Likewise.
* lib/Makefile.am: Likewise.
* libasm/Makefile.am: Likewise.
* libcpu/Makefile.am: Likewise.
* libdw/Makefile.am: Likewise,
and set object lists to manifest contents.
* libdwelf/Makefile.am: Likewise.
* libdwfl/Makefile.am: Likewise.
* libebl/Makefile.am: Likewise.
* libelf/Makefile.am: Likewise,
and set object lists to manifest contents.
* src/Makefile.am: Likewise.
Signed-off-by: Michael Pratt <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
If desthdr is ".got.plt" search for the actual ".got" section and make
sure the _GLOBAL_OFFSET_TABLE_ points to it.
* backends/riscv_symbol.c (riscv_check_special_symbol): Check
sname is ".got.plt", find ".got" scn to check sym st_value.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To increase the consistency of how automatic clean targets run,
define the variables together without +=, default to MOSTLYCLEANFILES
when there is no need for different levels or
add more clean levels to match other subdirectories,
add more files that are built, remove duplication, and cleanup.
Do the same for EXTRA_DIST where it is equally messy.
* backends/Makefile.am: add more objects to clean, improve spacing.
* debuginfod/Makefile.am: Likewise, and remove duplicates.
* lib/Makefile.am: improve spacing.
* libasm/Makefile.am: add more objects to clean, split similar to debuginfod.
* libcpu/Makefile.am: use normal =, add more objects to clean.
* libdw/Makefile.am: add more objects to clean, split similar to debuginfod.
* libdwelf/Makefile.am: add more objects to clean, use lowest clean level.
* libdwfl/Makefile.am: Likewise.
* libebl/Makefile.am: add more objects to clean.
* libelf/Makefile.am: add more objects to clean, split similar to debuginfod.
* src/Makefile.am: consolidate including EXTRA_DIST, split clean levels,
define with normal =, define with variables.
* tests/Makefile.am: Likewise, but not including EXTRA_DIST.
Signed-off-by: Michael Pratt <[email protected]>
|
| |
|
|
|
|
|
| |
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]>
|