mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-01 06:41:51 -04:00
+40
-4
@@ -45,13 +45,28 @@ then you just add a line saying
|
||||
|
||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
using a known identity (sorry, no anonymous contributions.)
|
||||
The name you use as your identity should not be an anonymous id
|
||||
or false name that misrepresents who you are.
|
||||
|
||||
git commit --signoff will add such a Signed-off-by line at the end of
|
||||
the commit log message for you.
|
||||
|
||||
The ideal patch contains a ChangeLog entry and a test case for the
|
||||
bug fixed or feature added.
|
||||
The ideal patch contains a ChangeLog entry for the commit message and
|
||||
a test case for the bug fixed or feature added.
|
||||
|
||||
The commit message is expected to start with a one line summary of
|
||||
what the patch does, prefixed with the main subdir the patch applies
|
||||
to. e.g libelf: Rewind the elf_frob function bar definitions.
|
||||
|
||||
Finally please include an ChangeLog entry explicitly listing the files
|
||||
and what changed in each of them in the commit message. This will help
|
||||
a reviewer understand which changes are expected (and which might be
|
||||
accidential). Try to follow the GNU Change Log style:
|
||||
https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html
|
||||
Note that elfutils previously maintained separate ChangeLog
|
||||
files. These are no longer used. All changes should be documented in
|
||||
the git commit message.
|
||||
|
||||
The testsuite (make check) is expected to have zero failing tests.
|
||||
Do not knowingly add tests that FAIL. If there are architectures or
|
||||
@@ -69,6 +84,22 @@ After sending your patch to the mailinglist one of the committers
|
||||
to the project will review it, give feedback, and if perfect they
|
||||
will commit it for you.
|
||||
|
||||
All patches sent to the mailing list are tracked at
|
||||
https://patchwork.sourceware.org/project/elfutils/list/
|
||||
|
||||
To use this from the command line you can use git-pw
|
||||
https://patchwork.readthedocs.io/projects/git-pw/en/latest/
|
||||
|
||||
For using it with git-pw use these .git/config settings:
|
||||
[pw]
|
||||
server = https://patchwork.sourceware.org/api/1.2/
|
||||
project = elfutils
|
||||
token = <hex-token>
|
||||
states = committed,accepted,superseded,deferred,rejected,under-review
|
||||
|
||||
If you would like to help maintain the pending patch list your
|
||||
patchwork account can be added as maintainer for the elfutils project.
|
||||
|
||||
You can become a maintainer/committer yourself after you have provided
|
||||
at least a handful of accepted patches and agree to the guidelines in
|
||||
this document for creating, reviewing, accepting and committing patches.
|
||||
@@ -96,10 +127,15 @@ mailinglist that the patch has been pushed.
|
||||
committers may also create git branches starting with <nickname>/...
|
||||
patches on these branches are works in progress, so might not be perfect
|
||||
yet, but should follow the above guidelines as much as possible and should
|
||||
be aimed at integration into master. For merging a branch into master
|
||||
be aimed at integration into main. For merging a branch into main
|
||||
the same process as above should be followed by posting the patches
|
||||
to the list first.
|
||||
|
||||
Note that a branch starting with <nickname>/try... will be picked up
|
||||
by the Sourceware buildbot and can be used to test your patches before
|
||||
merging into the main branch:
|
||||
https://builder.sourceware.org/buildbot/#/builders?tags=elfutils-try
|
||||
|
||||
committers/maintainers who repeatedly ignore the above guidelines,
|
||||
are hostile or offensive towards other committers or contributors,
|
||||
and don't correct their behavior after being asked by other committers
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
2023-03-27 Di Chen <dichen@redhat.com>
|
||||
|
||||
* NEWS: Support readelf -Ds for using dynamic segment to
|
||||
print symbol table.
|
||||
|
||||
2023-03-03 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* NEWS: Add ELFCOMPRESS_ZSTD support for libelf and elfcompress.
|
||||
|
||||
2023-02-23 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* NEWS: Add old version code names.
|
||||
|
||||
2023-02-21 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* configure.ac: Check for -Wuse-after-free=3
|
||||
|
||||
2023-02-15 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* configure.ac: Error out when demangler is enabled, but
|
||||
__cxa_demangle cannot be found.
|
||||
|
||||
2023-01-11 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* configure.ac: Add some rlimit/affinity checks.
|
||||
|
||||
2022-11-02 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* configure.ac (AC_INIT): Set version to 0.188.
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ pkginclude_HEADERS = version.h
|
||||
SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \
|
||||
libasm debuginfod src po doc tests
|
||||
|
||||
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
|
||||
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \
|
||||
COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
|
||||
# Make sure the test install uses lib64 when $LIB will yield lib64.
|
||||
|
||||
@@ -1,4 +1,48 @@
|
||||
Version 0.188
|
||||
Version 0.190 "Woke!"
|
||||
|
||||
CONTRIBUTING: Switch from real name policy to known identity policy.
|
||||
Updated ChangeLog policy (no more separate ChangeLog files).
|
||||
There is a SECURITY bug policy now.
|
||||
The default branch is now 'main'.
|
||||
|
||||
libelf: Add RELR support.
|
||||
|
||||
libdw: Recognize .debug_[ct]u_index sections
|
||||
|
||||
readelf: Support readelf -Ds, --use-dynamic --symbol.
|
||||
Support .gdb_index version 9
|
||||
|
||||
scrlines: New tool that compiles a list of source files associated
|
||||
with a specified dwarf/elf file.
|
||||
|
||||
debuginfod: Schema change (reindexing required, sorry!) for a 60%
|
||||
compression in filename representation, which was a large
|
||||
part of the sqlite index; also, more deliberate sqlite
|
||||
-wal management during scanning using the
|
||||
--scan-checkpoint option.
|
||||
|
||||
backends: Various LoongArch updates.
|
||||
|
||||
Version 0.189 "Don't deflate!"
|
||||
|
||||
configure: eu-nm, eu-addr2line and eu-stack can provide demangled symbols
|
||||
when linked with libstdc++. Use --disable-demangler to disable.
|
||||
|
||||
A new option --enable-sanitize-memory has been added for msan
|
||||
sanitizer support.
|
||||
|
||||
libelf: elf_compress now supports ELFCOMPRESS_ZSTD when build against
|
||||
libzstd
|
||||
|
||||
libdwfl: dwfl_module_return_value_location now returns 0 (no return type)
|
||||
for DIEs that point to a DW_TAG_unspecified_type.
|
||||
|
||||
elfcompress: -t, --type= now support zstd if libelf has been build with
|
||||
ELFCOMPRESS_ZSTD support.
|
||||
|
||||
backends: Add support for LoongArch and Synopsys ARCv2 processors.
|
||||
|
||||
Version 0.188 "no section left behind"
|
||||
|
||||
readelf: Add -D, --use-dynamic option.
|
||||
|
||||
@@ -11,7 +55,7 @@ libdwfl: Add new function dwfl_get_debuginfod_client.
|
||||
Add new function dwfl_frame_reg.
|
||||
Add new function dwfl_report_offline_memory.
|
||||
|
||||
Version 0.187
|
||||
Version 0.187 "no zero negatives"
|
||||
|
||||
debuginfod: Support -C option for connection thread pooling.
|
||||
|
||||
@@ -30,7 +74,7 @@ libdw, debuginfo-client: Load libcurl lazily only when files need to
|
||||
DEBUGINFOD_URLS is set, libcurl is only loaded
|
||||
when the debuginfod_begin function is called.
|
||||
|
||||
Version 0.186
|
||||
Version 0.186 "Just In Time"
|
||||
|
||||
debuginfod-client: Default $DEBUGINFOD_URLS is computed from drop-in files
|
||||
/etc/debuginfod/*.urls rather than hardcoded into the
|
||||
@@ -56,7 +100,7 @@ libdw: Support for the NVIDIA Cuda line map extensions.
|
||||
|
||||
translations: Update Japanese translation.
|
||||
|
||||
Version 0.185
|
||||
Version 0.185 "oops, I did it again"
|
||||
|
||||
debuginfod-client: Simplify curl handle reuse so downloads which
|
||||
return an error are retried.
|
||||
@@ -64,7 +108,7 @@ debuginfod-client: Simplify curl handle reuse so downloads which
|
||||
elfcompress: Always exit with code 0 when the operation succeeds (even
|
||||
when nothing was done). On error the exit code is now always 1.
|
||||
|
||||
Version 0.184
|
||||
Version 0.184 "negative results"
|
||||
|
||||
debuginfod: Use libarchive's bsdtar as the .deb-family file unpacker.
|
||||
|
||||
@@ -83,7 +127,7 @@ libdw: handle DW_FORM_indirect when reading attributes
|
||||
|
||||
translations: Update Polish translation.
|
||||
|
||||
Version 0.183
|
||||
Version 0.183 "100+ commits"
|
||||
|
||||
debuginfod: New thread-busy metric and more detailed error metrics.
|
||||
New --fdcache-mintmp and tracking of filesystem freespace.
|
||||
@@ -100,7 +144,7 @@ config: profile.sh and profile.csh won't export DEBUGINFOD_URLS unless
|
||||
elflint, readelf: Recognize SHF_GNU_RETAIN.
|
||||
Handle SHT_X86_64_UNWIND as valid relocation target.
|
||||
|
||||
Version 0.182
|
||||
Version 0.182 "October Surprise!"
|
||||
|
||||
backends: Support for tilegx has been removed.
|
||||
|
||||
@@ -114,7 +158,7 @@ debuginfod-client: Now supports compressed (kernel) ELF images.
|
||||
|
||||
libdwfl: Add ZSTD compression support.
|
||||
|
||||
Version 0.181
|
||||
Version 0.181 "Show me your ARMs"
|
||||
|
||||
libelf: elf_update now compensates (fixes up) a bad sh_addralign for
|
||||
SHF_COMPRESSED sections.
|
||||
@@ -131,7 +175,7 @@ libdw, readelf: Recognize DW_CFA_AARCH64_negate_ra_state. Allows unwinding
|
||||
on arm64 for code that is compiled for PAC (Pointer
|
||||
Authentication Code) as long as it isn't enabled.
|
||||
|
||||
Version 0.180
|
||||
Version 0.180 "We got an L, we got an T, can we have a O?"
|
||||
|
||||
elflint: Allow SHF_EXCLUDE as generic section flag when --gnu is given.
|
||||
|
||||
@@ -145,7 +189,7 @@ size: Also obey radix printing for bsd format.
|
||||
|
||||
nm: Explicitly print weak 'V' or 'T' and common 'C' symbols.
|
||||
|
||||
Version 0.179
|
||||
Version 0.179 "All your packages are belong to us!"
|
||||
|
||||
debuginfod-client: When DEBUGINFOD_PROGRESS is set and the program doesn't
|
||||
install its own debuginfod_progressfn_t show download
|
||||
@@ -180,7 +224,7 @@ readelf, elflint: Handle PT_GNU_PROPERTY.
|
||||
|
||||
translations: Updated Ukrainian translation.
|
||||
|
||||
Version 0.178
|
||||
Version 0.178 "All the build-id you can count!"
|
||||
|
||||
debuginfod: New server, client tool and library to index and fetch
|
||||
ELF/DWARF files addressed by build-id through HTTP.
|
||||
@@ -202,7 +246,7 @@ libdw: Abbrevs and DIEs can now be read concurrently by multiple
|
||||
libdwfl: Will try to use debuginfod when installed as fallback to
|
||||
retrieve ELF and DWARF debug data files by build-id.
|
||||
|
||||
Version 0.177
|
||||
Version 0.177 "What is your category, class and taxonomy?"
|
||||
|
||||
elfclassify: New tool to analyze ELF objects.
|
||||
|
||||
@@ -218,7 +262,7 @@ libdwelf: Add dwelf_elf_e_machine_string.
|
||||
|
||||
backends: Add support for C-SKY.
|
||||
|
||||
Version 0.176
|
||||
Version 0.176 "At your own RISC-V"
|
||||
|
||||
build: Add new --enable-install-elfh option.
|
||||
Do NOT use this for system installs (it overrides glibc elf.h).
|
||||
@@ -246,7 +290,7 @@ backends: RISCV handles ADD/SUB relocations. Handle SHT_X86_64_UNWIND.
|
||||
|
||||
Fixes CVE-2018-18310, CVE-2018-18520 and CVE-2018-18521.
|
||||
|
||||
Version 0.174
|
||||
Version 0.174 "extended shnum"
|
||||
|
||||
libelf, libdw and all tools now handle extended shnum and shstrndx correctly.
|
||||
|
||||
@@ -262,7 +306,7 @@ backends: RISCV and M68K now have backend implementations to generate CFI based
|
||||
|
||||
Fixes CVE-2018-16062, CVE-2018-16402 and CVE-2018-16403.
|
||||
|
||||
Version 0.173
|
||||
Version 0.173 "crash free"
|
||||
|
||||
More fixes for crashes and hangs found by afl-fuzz. In particular various
|
||||
functions now detect and break infinite loops caused by bad DIE tree cycles.
|
||||
@@ -280,16 +324,16 @@ backends: Handle BPF simple relocations.
|
||||
The RISCV backends now handles ABI specific CFI and knows about
|
||||
RISCV register types and names.
|
||||
|
||||
Version 0.172
|
||||
Version 0.172 "DWARF5 bugs split!"
|
||||
|
||||
No functional changes compared to 0.171.
|
||||
No functional changes compared to 0.171 "DWARF5 split!".
|
||||
|
||||
Various bug fixes in libdw and eu-readelf dealing with bad DWARF5 data.
|
||||
Thanks to running the afl fuzzer on eu-readelf and various testcases.
|
||||
|
||||
eu-readelf -N is ~15% faster.
|
||||
|
||||
Version 0.171
|
||||
Version 0.171 "DWARF5 split!"
|
||||
|
||||
DWARF5 and split dwarf, including GNU DebugFission, are supported now.
|
||||
Data can be read from the new DWARF sections .debug_addr, .debug_line_str,
|
||||
@@ -327,7 +371,7 @@ backends: Add a RISC-V backend.
|
||||
There were various improvements to build on Windows.
|
||||
The sha1 and md5 implementations have been removed, they weren't used.
|
||||
|
||||
Version 0.170
|
||||
Version 0.170 "DWARF4 1/2"
|
||||
|
||||
libdw: Added new DWARF5 attribute, tag, character encoding, language code,
|
||||
calling convention, defaulted member function and macro constants
|
||||
@@ -347,7 +391,7 @@ backends: Add support for EM_PPC64 GNU_ATTRIBUTES.
|
||||
|
||||
translations: Update Polish translation.
|
||||
|
||||
Version 0.168
|
||||
Version 0.168 "kthxbye"
|
||||
|
||||
http://elfutils.org/ is now hosted at http://sourceware.org/elfutils/
|
||||
|
||||
@@ -357,7 +401,7 @@ libdw: dwarf.h corrected the DW_LANG_PLI constant name (was DW_LANG_PL1).
|
||||
|
||||
readelf: Add optional --symbols[=SECTION] argument to select section name.
|
||||
|
||||
Version 0.167
|
||||
Version 0.167 "disassemble this!"
|
||||
|
||||
libasm: Add eBPF disassembler for EM_BPF files.
|
||||
|
||||
@@ -369,12 +413,12 @@ dwelf: Add ELF/DWARF string table creation functions. dwelf_strtab_init,
|
||||
dwelf_strtab_add, dwelf_strtab_add_len, dwelf_strtab_finalize,
|
||||
dwelf_strent_off, dwelf_strent_str and dwelf_strtab_free.
|
||||
|
||||
Version 0.166
|
||||
Version 0.166 "bugs be gone!"
|
||||
|
||||
config: The default program prefix for the installed tools is now eu-.
|
||||
Use configure --program-prefix="" to not use a program prefix.
|
||||
|
||||
Version 0.165
|
||||
Version 0.165 "big DWARF & tiny ELF"
|
||||
|
||||
elfcompress: New utility to compress or decompress ELF sections.
|
||||
|
||||
@@ -391,7 +435,7 @@ backends: sparc support for core and live backtraces.
|
||||
|
||||
translations: Updated Polish translation.
|
||||
|
||||
Version 0.164
|
||||
Version 0.164 "strip, no unstrip!"
|
||||
|
||||
strip, unstrip: Handle ELF files with merged strtab/shstrtab tables.
|
||||
Handle missing SHF_INFO_LINK section flags.
|
||||
@@ -412,11 +456,11 @@ translations: Updated Ukrainian translation.
|
||||
|
||||
Provide default-yama-scope subpackage.
|
||||
|
||||
Version 0.163
|
||||
Version 0.163 "size matters"
|
||||
|
||||
Bug fixes only, no new features.
|
||||
|
||||
Version 0.162
|
||||
Version 0.162 "hard hat"
|
||||
|
||||
libdw: Install new header elfutils/known-dwarf.h.
|
||||
dwarf.h Add preliminary DWARF5 constants DW_TAG_atomic_type,
|
||||
|
||||
@@ -29,3 +29,5 @@ Or use the form at https://sourceware.org/mailman/listinfo/elfutils-devel
|
||||
See the CONTRIBUTING file for how to propose patches to the code.
|
||||
|
||||
See the NOTES files for some design decisions and notes.
|
||||
|
||||
See the SECURITY file for defining and handling security-sensitive bugs.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
The elfutils library and utilities aim to be generally robust and
|
||||
reliable. However, elfutils routinely processes complex binary
|
||||
structured data. This makes the code intricate and sometimes brittle.
|
||||
While elfutils developers use a variety of static and dynamic checker
|
||||
software (valgrind, sanitizers) in testing, bugs may remain. Some of
|
||||
these bugs may have security-related implications.
|
||||
|
||||
|
||||
While many errors are cleanly detected at runtime, it is possible that
|
||||
vulnerabilities exist that could be exploitable. These may arise from
|
||||
crafted / fuzzed / erroneous inputs, or perhaps even from valid inputs
|
||||
with unforseen characteristics. Therefore, to minimize risks, users
|
||||
of elfutils tools and libraries should consider measures such as:
|
||||
|
||||
- avoiding running complex elfutils analysis on untrustworthy inputs
|
||||
- avoiding running elfutils tools as privileged processes
|
||||
- applying common platform level protection mechanisms such as
|
||||
selinux, syscall filtering, hardened compilation, etc.
|
||||
|
||||
Since most elfutils tools are run in short-lived, local, interactive,
|
||||
development context rather than remotely "in production", we generally
|
||||
treat malfunctions as ordinary bugs rather than security vulnerabilities.
|
||||
|
||||
|
||||
Elfutils includes one network client/server: debuginfod. The
|
||||
debuginfod man page contains a SECURITY section outlining the general
|
||||
risks. tl;dr: many classes of server problems are delegated to
|
||||
front-end proxies and curated elf/dwarf archives of the operator;
|
||||
others to careful configuration of the debuginfod client. These are
|
||||
not generally reportable as security vulnerabilities. However, we are
|
||||
likely to accept security vulnerability reports related to:
|
||||
|
||||
- availability: e.g., remotely exploitable server crash, but not
|
||||
routine resource exhaustion or overload; client crash due to
|
||||
unexpected valid traffic from trusted server
|
||||
|
||||
- confidentiality: e.g., allowing the server to expose one client's
|
||||
traffic to another client
|
||||
|
||||
- integrity: e.g., causing the server to send erroneous
|
||||
elf/dwarf/source data across the webapi; causing the client to
|
||||
corrupt its cache to lose file integrity
|
||||
|
||||
We welcome reports that are tangential to any of these subjects.
|
||||
|
||||
Please report bugs via any of:
|
||||
- email to <elfutils-devel@sourceware.org>
|
||||
- https://sourceware.org/bugzilla/enter_bug.cgi?product=elfutils
|
||||
|
||||
After considering the above exclusions, please report suspected
|
||||
security vulnerabilities confidentially via any of:
|
||||
|
||||
- email to <mark@klomp.org>
|
||||
- email to <fche@elastic.org>
|
||||
- email to <secalert@redhat.com>
|
||||
@@ -1,3 +1,68 @@
|
||||
2023-05-09 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* Makefile.am (loongarch_SRCS): Add loongarch_initreg.c.
|
||||
* loongarch_initreg.c: New file.
|
||||
* loongarch_init.c (loongarch_init): Hook set_initial_registers_tid.
|
||||
|
||||
2023-04-07 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* Makefile.am (loongarch_SRCS): Add loongarch_corenote.c.
|
||||
* loongarch_init.c (loongarch_init): Hook core_note.
|
||||
* loongarch_corenote.c: New file.
|
||||
|
||||
2023-04-07 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* Makefile.am (loongarch_SRCS): Add loongarch_unwind.c.
|
||||
* loongarch_init.c (loongarch_init): Hook unwind.
|
||||
* loongarch_unwind.c: New file.
|
||||
|
||||
2023-04-07 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* Makefile.am (loongarch_SRCS): Add loongarch_retval.c.
|
||||
* loongarch_init.c (loongarch_init): Hook return_value_location.
|
||||
* loongarch_retval.c: New file.
|
||||
|
||||
2023-04-07 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* Makefile.am (loongarch_SRCS): Add loongarch_cfi.c and loongarch_regs.c.
|
||||
* loongarch_cfi.c: New file.
|
||||
* loongarch_regs.c: Likewise.
|
||||
* loongarch_init.c (loongarch_init): Hook register_info and abi_cfi.
|
||||
|
||||
2023-04-01 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* loongarch_init.c (loongarch_init): Hook check_special_symbol.
|
||||
* loongarch_symbol.c (loongarch_check_special_symbol): New function.
|
||||
|
||||
2023-04-01 Youling Tang <tangyouling@loongson.cn>
|
||||
|
||||
* loongarch_reloc.def: Add RELOC_TYPE B16 to RELAX.
|
||||
|
||||
2023-02-07 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* libebl_CPU.h (dwarf_peeled_die_type): Explicitly handle
|
||||
DW_TAG_unspecified_type as if there was no DW_AT_type.
|
||||
|
||||
2023-01-19 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* sparc_reloc.def (NONE): Add EXEC and DYN.
|
||||
|
||||
2022-12-21 Shahab Vahedi <shahab@synopsys.email>
|
||||
|
||||
* Makefile.am (modules): Add arc.
|
||||
(arc_SRCS): Added.
|
||||
(libebl_backends_a_SOURCES): Append arc_SRCS.
|
||||
* arc_init.c: New file.
|
||||
* arc_reloc.def: New file.
|
||||
* arc_symbol.c: New file.
|
||||
|
||||
2022-12-02 Hengqi Chen <hengqi.chen@gmail.com>
|
||||
|
||||
* Makefile.am (modules): Add loongarch.
|
||||
* loongarch_init.c: New file.
|
||||
* loongarch_reloc.def: New file.
|
||||
* loongarch_symbol.c: New file.
|
||||
|
||||
2022-08-09 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* riscv_init.c (riscv_init): HOOK segment_type_name,
|
||||
|
||||
@@ -37,7 +37,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
|
||||
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
|
||||
m68k bpf riscv csky loongarch arc
|
||||
|
||||
i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \
|
||||
i386_retval.c i386_regs.c i386_auxv.c \
|
||||
@@ -96,11 +96,18 @@ riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
|
||||
csky_SRCS = csky_attrs.c csky_init.c csky_symbol.c csky_cfi.c \
|
||||
csky_regs.c csky_initreg.c csky_corenote.c
|
||||
|
||||
loongarch_SRCS = loongarch_init.c loongarch_symbol.c loongarch_cfi.c \
|
||||
loongarch_regs.c loongarch_retval.c loongarch_initreg.c \
|
||||
loongarch_unwind.c loongarch_corenote.c
|
||||
|
||||
arc_SRCS = arc_init.c arc_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)
|
||||
$(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
|
||||
$(loongarch_SRCS) $(arc_SRCS)
|
||||
|
||||
libebl_backends_pic_a_SOURCES =
|
||||
am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
|
||||
|
||||
@@ -303,12 +303,11 @@ aarch64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type
|
||||
|| tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (tag == DW_TAG_base_type || dwarf_is_pointer (tag))
|
||||
{
|
||||
if (dwarf_bytesize_aux (&typedie, &size) < 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -89,15 +89,14 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
Dwarf_Word size;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Initialization of ARC specific backend library.
|
||||
Copyright (C) 2022 Synopsys 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/>. */
|
||||
|
||||
/* More details on an ARC elf can be found at:
|
||||
https://github.com/foss-for-synopsys-dwc-arc-processors/ \
|
||||
arc-ABI-manual/blob/master/arcv3-elf.md */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arc_
|
||||
#define RELOC_PREFIX R_ARC_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on arc_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
Ebl *
|
||||
arc_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
arc_init_reloc (eh);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, section_type_name);
|
||||
|
||||
/* /bld/gcc-stage2/arc-snps-linux-gnu/libgcc/libgcc.map.in
|
||||
#define __LIBGCC_DWARF_FRAME_REGISTERS__. */
|
||||
eh->frame_nregs = 146;
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* List the relocation types for ARC. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (24, REL|EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N24, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (SDA, REL)
|
||||
RELOC_TYPE (SECTOFF, REL)
|
||||
RELOC_TYPE (S21H_PCREL, REL)
|
||||
RELOC_TYPE (S21W_PCREL, REL)
|
||||
RELOC_TYPE (S25H_PCREL, REL)
|
||||
RELOC_TYPE (S25W_PCREL, REL)
|
||||
RELOC_TYPE (SDA32, REL)
|
||||
RELOC_TYPE (SDA_LDST, REL)
|
||||
RELOC_TYPE (SDA_LDST1, REL)
|
||||
RELOC_TYPE (SDA_LDST2, REL)
|
||||
RELOC_TYPE (SDA16_LD, REL)
|
||||
RELOC_TYPE (SDA16_LD1, REL)
|
||||
RELOC_TYPE (SDA16_LD2, REL)
|
||||
RELOC_TYPE (S13_PCREL, REL)
|
||||
RELOC_TYPE (W, REL)
|
||||
RELOC_TYPE (32_ME, REL)
|
||||
RELOC_TYPE (N32_ME, REL)
|
||||
RELOC_TYPE (SECTOFF_ME, REL)
|
||||
RELOC_TYPE (SDA32_ME, REL)
|
||||
RELOC_TYPE (W_ME, REL)
|
||||
RELOC_TYPE (SDA_12, REL)
|
||||
RELOC_TYPE (SDA16_ST2, REL)
|
||||
RELOC_TYPE (32_PCREL, REL)
|
||||
RELOC_TYPE (PC32, REL)
|
||||
RELOC_TYPE (GOTPC32, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (GOTOFF, REL)
|
||||
RELOC_TYPE (GOTPC, REL)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (S21W_PCREL_PLT, REL)
|
||||
RELOC_TYPE (S25H_PCREL_PLT, REL)
|
||||
RELOC_TYPE (JLI_SECTOFF, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD, REL)
|
||||
RELOC_TYPE (TLS_DTPOFF, REL)
|
||||
RELOC_TYPE (TLS_TPOFF, REL)
|
||||
RELOC_TYPE (TLS_GD_GOT, REL)
|
||||
RELOC_TYPE (TLS_GD_LD, REL)
|
||||
RELOC_TYPE (TLS_GD_CALL, REL)
|
||||
RELOC_TYPE (TLS_IE_GOT, REL)
|
||||
RELOC_TYPE (TLS_DTPOFF_S9, REL)
|
||||
RELOC_TYPE (TLS_LE_S9, REL)
|
||||
RELOC_TYPE (TLS_LE_32, REL)
|
||||
RELOC_TYPE (S25W_PCREL_PLT, REL)
|
||||
RELOC_TYPE (S21H_PCREL_PLT, REL)
|
||||
RELOC_TYPE (NPS_CMEM16, REL)
|
||||
@@ -0,0 +1,81 @@
|
||||
/* ARC specific symbolic name handling.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND arc_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check whether machine flags are valid. */
|
||||
bool
|
||||
arc_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
return ((flags & ~EF_ARC_ALL_MSK) == 0);
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
arc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_ARC_32:
|
||||
return ELF_T_WORD;
|
||||
case R_ARC_16:
|
||||
return ELF_T_HALF;
|
||||
case R_ARC_8:
|
||||
return ELF_T_BYTE;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return symbolic representation of section type. */
|
||||
const char *
|
||||
arc_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHT_ARC_ATTRIBUTES:
|
||||
return "ARC_ATTRIBUTES";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -86,14 +86,13 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -89,15 +89,14 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Word size;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -264,14 +264,13 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
+27
-2
@@ -1,5 +1,6 @@
|
||||
/* Common interface for libebl modules.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc.
|
||||
Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
@@ -53,7 +54,9 @@ extern bool (*generic_debugscn_p) (const char *) attribute_hidden;
|
||||
dwarf_tag (_die); })
|
||||
|
||||
/* Get a type die corresponding to DIE. Peel CV qualifiers off
|
||||
it. */
|
||||
it. Returns zero if the DIE doesn't have a type, or the type
|
||||
is DW_TAG_unspecified_type. Returns -1 on error. Otherwise
|
||||
returns the result tag DW_AT value. */
|
||||
static inline int
|
||||
dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
|
||||
{
|
||||
@@ -63,13 +66,35 @@ dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
|
||||
/* The function has no return value, like a `void' function in C. */
|
||||
return 0;
|
||||
|
||||
if (result == NULL)
|
||||
return -1;
|
||||
|
||||
if (dwarf_formref_die (attr, result) == NULL)
|
||||
return -1;
|
||||
|
||||
if (dwarf_peel_type (result, result) != 0)
|
||||
return -1;
|
||||
|
||||
return DWARF_TAG_OR_RETURN (result);
|
||||
int tag = dwarf_tag (result);
|
||||
if (tag == DW_TAG_unspecified_type)
|
||||
return 0; /* Treat an unspecified type as if there was no type. */
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
dwarf_is_pointer (int tag)
|
||||
{
|
||||
return tag == DW_TAG_pointer_type
|
||||
|| tag == DW_TAG_ptr_to_member_type
|
||||
|| tag == DW_TAG_reference_type
|
||||
|| tag == DW_TAG_rvalue_reference_type;
|
||||
}
|
||||
|
||||
#define CASE_POINTER \
|
||||
case DW_TAG_pointer_type: \
|
||||
case DW_TAG_ptr_to_member_type: \
|
||||
case DW_TAG_reference_type: \
|
||||
case DW_TAG_rvalue_reference_type
|
||||
|
||||
#endif /* libebl_CPU.h */
|
||||
|
||||
@@ -239,6 +239,7 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
|
||||
return 0;
|
||||
*regs_offset = 0;
|
||||
*nregloc = 0;
|
||||
*reglocs = NULL;
|
||||
*nitems = 1;
|
||||
*items = vmcoreinfo_items;
|
||||
return 1;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/* LoongArch ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
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 loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* LoongArch ELF ABI specification:
|
||||
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_register_convention
|
||||
*/
|
||||
int
|
||||
loongarch_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
/* The initial Canonical Frame Address is the value of the
|
||||
Stack Pointer ($r3) as setup in the previous frame. */
|
||||
DW_CFA_def_cfa, ULEB128_7 (3), ULEB128_7 (0),
|
||||
|
||||
/* The Stack Pointer ($r3) is restored from CFA address by default. */
|
||||
DW_CFA_val_offset, ULEB128_7 (3), ULEB128_7 (0),
|
||||
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
/* The return address register contains the return address setup by
|
||||
caller. */
|
||||
SV (1),
|
||||
|
||||
/* Callee-saved registers $s0-$s7. */
|
||||
SV (23), SV (24), SV (25), SV (26), SV (27), SV (28),
|
||||
SV (29), SV (30), SV (31),
|
||||
|
||||
/* The Frame Pointer ($fp, $r22) */
|
||||
SV(22),
|
||||
|
||||
/* Callee-saved registers $fs0-$fs7. */
|
||||
SV (56), SV (57), SV (58), SV (59), SV (60), SV (61),
|
||||
SV (62), SV (63),
|
||||
#undef SV
|
||||
|
||||
/* XXX Note: registers intentionally unused by the program,
|
||||
for example as a consequence of the procedure call standard
|
||||
should be initialized as if by DW_CFA_same_value. */
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = -4;
|
||||
|
||||
abi_info->return_address_register = 1; /* ra. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/* LoongArch specific core note handling.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
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 loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define ULONG uint64_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint32_t
|
||||
#define GID_T uint32_t
|
||||
#define ALIGN_ULONG 8
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 4
|
||||
#define ALIGN_GID_T 4
|
||||
#define TYPE_ULONG ELF_T_XWORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_WORD
|
||||
#define TYPE_GID_T ELF_T_WORD
|
||||
|
||||
#define PRSTATUS_REGS_SIZE (45 * 8)
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 32, .bits = 64 }, /* r0..r31 */
|
||||
};
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "orig_a0", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 32 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_era", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 33 * 8), \
|
||||
.group = "register", \
|
||||
.pc_register = true \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_badvaddr", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 34 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_crmd", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 35 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_prmd", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 36 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_euen", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 37 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_ecfg", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 38 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_estat", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 39 * 8), \
|
||||
.group = "register" \
|
||||
}
|
||||
/* 40 ~ 44 reserved */
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Initialization of LoongArch specific backend library.
|
||||
Copyright (C) 2022 Hengqi Chen
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
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 loongarch_
|
||||
#define RELOC_PREFIX R_LARCH_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on loongarch_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
loongarch_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
loongarch_init_reloc (eh);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, abi_cfi);
|
||||
/* gcc/config/ #define DWARF_FRAME_REGISTERS. */
|
||||
eh->frame_nregs = 74;
|
||||
HOOK (eh, check_special_symbol);
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, unwind);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* Fetch live process registers from TID.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include <assert.h>
|
||||
#if defined __loongarch__ && defined __linux__
|
||||
# include <sys/uio.h>
|
||||
# include <sys/procfs.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
loongarch_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined __loongarch__ || !defined __linux__
|
||||
return false;
|
||||
#else /* __loongarch__ */
|
||||
|
||||
/* General registers. */
|
||||
struct user_regs_struct gregs;
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = &gregs;
|
||||
iovec.iov_len = sizeof (gregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
/* $r0 is constant 0. */
|
||||
Dwarf_Word zero = 0;
|
||||
if (! setfunc (0, 1, &zero, arg))
|
||||
return false;
|
||||
|
||||
/* $r1-$r31. */
|
||||
if (! setfunc (1, 32, (Dwarf_Word *) &gregs.regs[1], arg))
|
||||
return false;
|
||||
|
||||
/* PC. */
|
||||
if (! setfunc (-1, 1, (Dwarf_Word *) &gregs.csr_era, arg))
|
||||
return false;
|
||||
|
||||
/* Floating-point registers (only 64bits are used). */
|
||||
struct user_fp_struct fregs;
|
||||
iovec.iov_base = &fregs;
|
||||
iovec.iov_len = sizeof (fregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
/* $f0-$f31 */
|
||||
if (! setfunc (32, 32, (Dwarf_Word *) &fregs.fpr[0], arg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#endif /* __loongarch__ */
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/* Register names and numbers for LoongArch DWARF.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
loongarch_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 64;
|
||||
|
||||
*prefix = "";
|
||||
|
||||
if (regno < 32)
|
||||
{
|
||||
*setname = "integer";
|
||||
*type = DW_ATE_signed;
|
||||
*bits = ebl->class == ELFCLASS64 ? 64 : 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
*setname = "FPU";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 64;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0:
|
||||
return stpcpy (name, "zero") + 1 - name;
|
||||
|
||||
case 1:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "ra") + 1 - name;
|
||||
|
||||
case 2:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "tp") + 1 - name;
|
||||
|
||||
case 3:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "sp") + 1 - name;
|
||||
|
||||
case 4 ... 11:
|
||||
name[0] = 'a';
|
||||
name[1] = regno - 4 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 12 ... 20:
|
||||
name[0] = 't';
|
||||
name[1] = regno - 12 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 21:
|
||||
return stpcpy (name, "u0") + 1 - name;
|
||||
|
||||
case 22:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "fp") + 1 - name;
|
||||
|
||||
case 23 ... 31:
|
||||
name[0] = 's';
|
||||
name[1] = regno - 23 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 32 ... 39:
|
||||
name[0] = 'f';
|
||||
name[1] = 'a';
|
||||
name[2] = regno - 32 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 40 ... 49:
|
||||
name[0] = 'f';
|
||||
name[1] = 't';
|
||||
name[2] = regno - 40 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 50 ... 55:
|
||||
name[0] = 'f';
|
||||
name[1] = 't';
|
||||
name[2] = '1';
|
||||
name[3] = regno - 50 + '0';
|
||||
namelen = 4;
|
||||
break;
|
||||
|
||||
case 56 ... 63:
|
||||
name[0] = 'f';
|
||||
name[1] = 's';
|
||||
name[2] = regno - 56 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/* List the relocation types for LoongArch. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL64, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL64, EXEC|DYN)
|
||||
RELOC_TYPE (IRELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (MARK_LA, REL)
|
||||
RELOC_TYPE (MARK_PCREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_PCREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_ABSOLUTE, REL)
|
||||
RELOC_TYPE (SOP_PUSH_DUP, REL)
|
||||
RELOC_TYPE (SOP_PUSH_GPREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_TPREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_GOT, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_GD, REL)
|
||||
RELOC_TYPE (SOP_PUSH_PLT_PCREL, REL)
|
||||
RELOC_TYPE (SOP_ASSERT, REL)
|
||||
RELOC_TYPE (SOP_NOT, REL)
|
||||
RELOC_TYPE (SOP_SUB, REL)
|
||||
RELOC_TYPE (SOP_SL, REL)
|
||||
RELOC_TYPE (SOP_SR, REL)
|
||||
RELOC_TYPE (SOP_ADD, REL)
|
||||
RELOC_TYPE (SOP_AND, REL)
|
||||
RELOC_TYPE (SOP_IF_ELSE, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_5, REL)
|
||||
RELOC_TYPE (SOP_POP_32_U_10_12, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_12, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_16, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_5_20, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_0_5_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_0_10_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_U, REL)
|
||||
RELOC_TYPE (ADD8, REL)
|
||||
RELOC_TYPE (ADD16, REL)
|
||||
RELOC_TYPE (ADD24, REL)
|
||||
RELOC_TYPE (ADD32, REL)
|
||||
RELOC_TYPE (ADD64, REL)
|
||||
RELOC_TYPE (SUB8, REL)
|
||||
RELOC_TYPE (SUB16, REL)
|
||||
RELOC_TYPE (SUB24, REL)
|
||||
RELOC_TYPE (SUB32, REL)
|
||||
RELOC_TYPE (SUB64, REL)
|
||||
RELOC_TYPE (GNU_VTINHERIT, REL)
|
||||
RELOC_TYPE (GNU_VTENTRY, REL)
|
||||
|
||||
/* reserved 59-63 */
|
||||
|
||||
RELOC_TYPE (B16, REL)
|
||||
RELOC_TYPE (B21, REL)
|
||||
RELOC_TYPE (B26, REL)
|
||||
RELOC_TYPE (ABS_HI20, REL)
|
||||
RELOC_TYPE (ABS_LO12, REL)
|
||||
RELOC_TYPE (ABS64_LO20, REL)
|
||||
RELOC_TYPE (ABS64_HI12, REL)
|
||||
RELOC_TYPE (PCALA_HI20, REL)
|
||||
RELOC_TYPE (PCALA_LO12, REL)
|
||||
RELOC_TYPE (PCALA64_LO20, REL)
|
||||
RELOC_TYPE (PCALA64_HI12, REL)
|
||||
RELOC_TYPE (GOT_PC_HI20, REL)
|
||||
RELOC_TYPE (GOT_PC_LO12, REL)
|
||||
RELOC_TYPE (GOT64_PC_LO20, REL)
|
||||
RELOC_TYPE (GOT64_PC_HI12, REL)
|
||||
RELOC_TYPE (GOT_HI20, REL)
|
||||
RELOC_TYPE (GOT_LO12, REL)
|
||||
RELOC_TYPE (GOT64_LO20, REL)
|
||||
RELOC_TYPE (GOT64_HI12, REL)
|
||||
RELOC_TYPE (TLS_LE_HI20, REL)
|
||||
RELOC_TYPE (TLS_LE_LO12, REL)
|
||||
RELOC_TYPE (TLS_LE64_LO20, REL)
|
||||
RELOC_TYPE (TLS_LE64_HI12, REL)
|
||||
RELOC_TYPE (TLS_IE_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_IE_PC_LO12, REL)
|
||||
RELOC_TYPE (TLS_IE64_PC_LO20, REL)
|
||||
RELOC_TYPE (TLS_IE64_PC_HI12, REL)
|
||||
RELOC_TYPE (TLS_IE_HI20, REL)
|
||||
RELOC_TYPE (TLS_IE_LO12, REL)
|
||||
RELOC_TYPE (TLS_IE64_LO20, REL)
|
||||
RELOC_TYPE (TLS_IE64_HI12, REL)
|
||||
RELOC_TYPE (TLS_LD_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_LD_HI20, REL)
|
||||
RELOC_TYPE (TLS_GD_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_GD_HI20, REL)
|
||||
RELOC_TYPE (32_PCREL, REL)
|
||||
RELOC_TYPE (RELAX, REL)
|
||||
RELOC_TYPE (DELETE, REL)
|
||||
RELOC_TYPE (ALIGN, REL)
|
||||
RELOC_TYPE (PCREL20_S2, REL)
|
||||
RELOC_TYPE (CFA, REL)
|
||||
RELOC_TYPE (ADD6, REL)
|
||||
RELOC_TYPE (SUB6, REL)
|
||||
RELOC_TYPE (ADD_ULEB128, REL)
|
||||
RELOC_TYPE (SUB_ULEB128, REL)
|
||||
RELOC_TYPE (64_PCREL, REL)
|
||||
@@ -0,0 +1,202 @@
|
||||
/* Function return value location for Linux/LoongArch ABI.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
|
||||
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 <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
static int
|
||||
dwarf_bytesize_aux (Dwarf_Die *die, Dwarf_Word *sizep)
|
||||
{
|
||||
int bits;
|
||||
if (((bits = 8 * dwarf_bytesize (die)) < 0
|
||||
&& (bits = dwarf_bitsize (die)) < 0)
|
||||
|| bits % 8 != 0)
|
||||
return -1;
|
||||
|
||||
*sizep = bits / 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_gpr (const Dwarf_Op **locp, Dwarf_Word size)
|
||||
{
|
||||
static const Dwarf_Op loc[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg4 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg5 }, { .atom = DW_OP_piece, .number = 8 }
|
||||
};
|
||||
|
||||
*locp = loc;
|
||||
return size <= 8 ? 1 : 4;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_by_ref (const Dwarf_Op **locp)
|
||||
{
|
||||
static const Dwarf_Op loc[] = { { .atom = DW_OP_breg4 } };
|
||||
|
||||
*locp = loc;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_fpr (const Dwarf_Op **locp, Dwarf_Word size)
|
||||
{
|
||||
static const Dwarf_Op loc[] =
|
||||
{
|
||||
{ .atom = DW_OP_regx, .number = 32 },
|
||||
{ .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_regx, .number = 33 },
|
||||
{ .atom = DW_OP_piece, .number = 8 }
|
||||
};
|
||||
|
||||
*locp = loc;
|
||||
return size <= 8 ? 1 : 4;
|
||||
}
|
||||
|
||||
int
|
||||
loongarch_return_value_location(Dwarf_Die *functypedie,
|
||||
const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die typedie;
|
||||
int tag = dwarf_peeled_die_type (functypedie, &typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
Dwarf_Word size = (Dwarf_Word)-1;
|
||||
|
||||
/* If the argument type is a Composite Type that is larger than 16
|
||||
bytes, then the argument is copied to memory allocated by the
|
||||
caller and the argument is replaced by a pointer to the copy. */
|
||||
if (tag == DW_TAG_structure_type || tag == DW_TAG_union_type
|
||||
|| tag == DW_TAG_class_type || tag == DW_TAG_array_type)
|
||||
{
|
||||
if (dwarf_aggregate_size (&typedie, &size) < 0)
|
||||
return -1;
|
||||
|
||||
/* Aggregates larger than 2*GRLEN bits are passed by reference. */
|
||||
if (size > 16)
|
||||
return pass_by_ref (locp);
|
||||
/* Aggregates whose total size is no more than GRLEN bits are passed in
|
||||
a register. Aggregates whose total size is no more than 2*GRLEN bits
|
||||
are passed in a pair of registers. */
|
||||
else
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type || dwarf_is_pointer (tag))
|
||||
{
|
||||
if (dwarf_bytesize_aux (&typedie, &size) < 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
Dwarf_Attribute attr_mem;
|
||||
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;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case DW_ATE_boolean:
|
||||
case DW_ATE_signed:
|
||||
case DW_ATE_unsigned:
|
||||
case DW_ATE_unsigned_char:
|
||||
case DW_ATE_signed_char:
|
||||
/* Scalars that are at most GRLEN bits wide are passed in a single
|
||||
argument register. Scalars that are 2*GRLEN bits wide are
|
||||
passed in a pair of argument registers. Scalars wider than
|
||||
2*GRLEN are passed by reference. */
|
||||
return pass_in_gpr (locp, size);
|
||||
|
||||
case DW_ATE_float:
|
||||
/* A real floating-point argument is passed in a floating-point
|
||||
argument register if it is no more than FLEN bits wide,
|
||||
otherwise it is passed according to the integer calling
|
||||
convention. */
|
||||
switch (size)
|
||||
{
|
||||
case 4: /* single */
|
||||
case 8: /* double */
|
||||
return pass_in_fpr (locp, size);
|
||||
|
||||
case 16: /* quad */
|
||||
return pass_in_gpr (locp, size);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
|
||||
case DW_ATE_complex_float:
|
||||
/* A complex floating-point number is passed as though it were a
|
||||
struct containing two floating-point reals. */
|
||||
switch (size)
|
||||
{
|
||||
case 8: /* float _Complex */
|
||||
case 16: /* double _Complex */
|
||||
return pass_in_fpr (locp, size);
|
||||
|
||||
case 32: /* long double _Complex */
|
||||
return pass_by_ref (locp);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
*locp = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/* LoongArch specific symbolic name handling.
|
||||
Copyright (C) 2022 Hengqi Chen
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
loongarch_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_LARCH_32:
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_64:
|
||||
return ELF_T_XWORD;
|
||||
case R_LARCH_ADD16:
|
||||
*addsub = 1;
|
||||
return ELF_T_HALF;
|
||||
case R_LARCH_ADD32:
|
||||
*addsub = 1;
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_ADD64:
|
||||
*addsub = 1;
|
||||
return ELF_T_XWORD;
|
||||
case R_LARCH_SUB16:
|
||||
*addsub = -1;
|
||||
return ELF_T_HALF;
|
||||
case R_LARCH_SUB32:
|
||||
*addsub = -1;
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_SUB64:
|
||||
*addsub = -1;
|
||||
return ELF_T_XWORD;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
loongarch_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
return ((flags &~ (EF_LARCH_ABI_MODIFIER_MASK
|
||||
| EF_LARCH_OBJABI_V1)) == 0);
|
||||
}
|
||||
|
||||
/* Check whether given symbol's st_value and st_size are OK despite failing
|
||||
normal checks. */
|
||||
bool
|
||||
loongarch_check_special_symbol (Elf *elf, const GElf_Sym *sym,
|
||||
const char *name, const GElf_Shdr *destshdr)
|
||||
{
|
||||
if (name != NULL
|
||||
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
|
||||
{
|
||||
size_t shstrndx;
|
||||
if (elf_getshdrstrndx (elf, &shstrndx) != 0)
|
||||
return false;
|
||||
const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
|
||||
if (sname != NULL
|
||||
&& (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
|
||||
{
|
||||
Elf_Scn *scn = NULL;
|
||||
while ((scn = elf_nextscn (elf, scn)) != NULL)
|
||||
{
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
if (shdr != NULL)
|
||||
{
|
||||
sname = elf_strptr (elf, shstrndx, shdr->sh_name);
|
||||
if (sname != NULL && strcmp (sname, ".got") == 0)
|
||||
return (sym->st_value >= shdr->sh_addr
|
||||
&& sym->st_value < shdr->sh_addr + shdr->sh_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* Get previous frame state for an existing frame state.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
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 loongarch_
|
||||
#define RA_REG 1
|
||||
#define SP_REG 3
|
||||
#define FP_REG 22
|
||||
|
||||
#define RA_OFFSET 8
|
||||
#define FP_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, ra, sp;
|
||||
|
||||
if (!getfunc(RA_REG, 1, &ra, arg))
|
||||
return false;
|
||||
|
||||
if (ra == 0 || !setfunc(-1, 1, &ra, arg))
|
||||
return false;
|
||||
|
||||
if (!getfunc(FP_REG, 1, &fp, arg))
|
||||
fp = 0;
|
||||
|
||||
if (!getfunc(SP_REG, 1, &sp, arg))
|
||||
sp = 0;
|
||||
|
||||
Dwarf_Word newRa, newFp, newSp;
|
||||
|
||||
if (!readfunc(fp - RA_OFFSET, &newRa, arg))
|
||||
newRa = 0;
|
||||
|
||||
if (!readfunc(fp - FP_OFFSET, &newFp, arg))
|
||||
newFp = 0;
|
||||
|
||||
newSp = fp;
|
||||
|
||||
// These are not fatal if they don't work. They will just prevent unwinding at the next frame.
|
||||
setfunc(RA_REG, 1, &newRa, arg);
|
||||
setfunc(FP_REG, 1, &newFp, arg);
|
||||
setfunc(SP_REG, 1, &newSp, arg);
|
||||
|
||||
// If the fp is invalid, we might still have a valid ra.
|
||||
// But if the fp is valid, then the stack should be moving in the right direction.
|
||||
return fp == 0 || newSp > sp;
|
||||
}
|
||||
@@ -96,15 +96,14 @@ m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Word size;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -100,14 +100,13 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -112,14 +112,13 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -81,3 +81,7 @@ RELOC_TYPE (SET8, REL)
|
||||
RELOC_TYPE (SET16, REL)
|
||||
RELOC_TYPE (SET32, REL)
|
||||
RELOC_TYPE (32_PCREL, REL)
|
||||
RELOC_TYPE (IRELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (SET_ULEB128, REL)
|
||||
RELOC_TYPE (SUB_ULEB128, REL)
|
||||
|
||||
@@ -170,12 +170,11 @@ riscv_return_value_location_lp64ifd (int fp, Dwarf_Die *functypedie,
|
||||
return pass_in_gpr_lp64 (locp, size);
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type
|
||||
|| tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (tag == DW_TAG_base_type || dwarf_is_pointer (tag))
|
||||
{
|
||||
if (dwarf_bytesize_aux (&typedie, &size) < 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -91,8 +91,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Die cudie;
|
||||
uint8_t asize;
|
||||
@@ -103,7 +102,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = asize;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -88,14 +88,13 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, REL)
|
||||
RELOC_TYPE (NONE, REL|EXEC|DYN)
|
||||
RELOC_TYPE (8, REL)
|
||||
RELOC_TYPE (16, REL)
|
||||
RELOC_TYPE (32, REL|DYN)
|
||||
|
||||
@@ -95,8 +95,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
@@ -104,7 +103,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
uint8_t asize;
|
||||
Dwarf_Die cudie;
|
||||
if ((tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
if (dwarf_is_pointer (tag)
|
||||
&& dwarf_diecu (typedie, &cudie, &asize, NULL) != NULL)
|
||||
size = asize;
|
||||
else
|
||||
|
||||
@@ -104,14 +104,13 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2023-02-21 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* eu.am (USE_AFTER_FREE3_WARNING): Define.
|
||||
(AM_CFLAGS): Use USE_AFTER_FREE3_WARNING.
|
||||
|
||||
2022-10-02 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* elfutils.spec.in: Update for 0.188.
|
||||
|
||||
+30
-1
@@ -233,7 +233,7 @@ fi
|
||||
|
||||
%files
|
||||
%license COPYING COPYING-GPLV2 COPYING-LGPLV3 doc/COPYING-GFDL
|
||||
%doc README TODO CONTRIBUTING
|
||||
%doc README TODO CONTRIBUTING SECURITY
|
||||
%{_bindir}/eu-addr2line
|
||||
%{_bindir}/eu-ar
|
||||
%{_bindir}/eu-elfclassify
|
||||
@@ -341,6 +341,35 @@ exit 0
|
||||
%systemd_postun_with_restart debuginfod.service
|
||||
|
||||
%changelog
|
||||
* Fri Nov 3 2023 Mark Wielaard <mark@klomp.org> 0.190-1
|
||||
- CONTRIBUTING: Switch from real name policy to known identity policy.
|
||||
Updated ChangeLog policy (no more separate ChangeLog files).
|
||||
There is a SECURITY bug policy now. The default branch is now 'main'.
|
||||
- libelf: Add RELR support.
|
||||
- libdw: Recognize .debug_[ct]u_index sections.
|
||||
- readelf: Support readelf -Ds, --use-dynamic --symbol.
|
||||
Support .gdb_index version 9
|
||||
- scrlines: New tool that compiles a list of source files associated
|
||||
with a specified dwarf/elf file.
|
||||
- debuginfod: Schema change (reindexing required, sorry!) for a 60%
|
||||
compression in filename representation, which was a large
|
||||
part of the sqlite index; also, more deliberate sqlite
|
||||
-wal management during scanning using the --scan-checkpoint option.
|
||||
- backends: Various LoongArch updates.
|
||||
|
||||
* Fri Mar 3 2023 Mark Wielaard <mark@klomp.org> 0.189-1
|
||||
- configure: eu-nm, eu-addr2line and eu-stack can provide demangled
|
||||
symbols when linked with libstdc++. Use --disable-demangler to disable.
|
||||
A new option --enable-sanitize-memory has been added for msan sanitizer
|
||||
support.
|
||||
- libelf: elf_compress now supports ELFCOMPRESS_ZSTD when build
|
||||
against libzstd
|
||||
- libdwfl: dwfl_module_return_value_location now returns 0 (no return
|
||||
type) for DIEs that point to a DW_TAG_unspecified_type.
|
||||
- elfcompress: -t, --type= now support zstd if libelf has been build
|
||||
with ELFCOMPRESS_ZSTD support.
|
||||
- backends: Add support for LoongArch and Synopsys ARCv2 processors.
|
||||
|
||||
* Wed Nov 2 2022 Mark Wielaard <mark@klomp.org> 0.188-1
|
||||
- readelf: Add -D, --use-dynamic option.
|
||||
- debuginfod-client: Add $DEBUGINFOD_HEADERS_FILE setting to supply
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Common automake fragments for elfutils subdirectory makefiles.
|
||||
##
|
||||
## Copyright (C) 2010, 2014, 2016 Red Hat, Inc.
|
||||
## Copyright (C) 2023, Mark J. Wielaard <mark@klomp.org>
|
||||
##
|
||||
## This file is part of elfutils.
|
||||
##
|
||||
@@ -87,10 +88,17 @@ else
|
||||
NO_PACKED_NOT_ALIGNED_WARNING=
|
||||
endif
|
||||
|
||||
if HAVE_USE_AFTER_FREE3_WARNING
|
||||
USE_AFTER_FREE3_WARNING=-Wuse-after-free=3
|
||||
else
|
||||
USE_AFTER_FREE3_WARNING=
|
||||
endif
|
||||
|
||||
AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
|
||||
-Wold-style-definition -Wstrict-prototypes $(TRAMPOLINES_WARNING) \
|
||||
$(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
|
||||
$(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
|
||||
$(USE_AFTER_FREE3_WARNING) \
|
||||
$(if $($(*F)_no_Werror),,-Werror) \
|
||||
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
|
||||
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
|
||||
|
||||
Executable → Regular
+1
-1
@@ -11,4 +11,4 @@ URL: http://elfutils.org/
|
||||
Libs: -L${libdir} -lelf
|
||||
Cflags: -I${includedir}
|
||||
|
||||
Requires.private: zlib
|
||||
Requires.private: zlib @LIBZSTD@
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Must be run in the source directory.
|
||||
# Should have passed make distcheck.
|
||||
# And all final changes should already have been pushed.
|
||||
# Backup copy will be created in $HOME/elfutils-$VERSION
|
||||
|
||||
# Any error is fatal
|
||||
set -e
|
||||
|
||||
# We take one arguent, the version (e.g. 0.173)
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 <version> (e.g. 0.169)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
|
||||
echo Make sure the git repo is tagged, signed and pushed
|
||||
echo git tag -s -m \"elfutils $VERSION release\" elfutils-$VERSION
|
||||
echo git push --tags
|
||||
|
||||
# Create a temporary directory and make sure it is cleaned up.
|
||||
tempdir=$(mktemp -d) || exit
|
||||
trap "rm -rf -- ${tempdir}" EXIT
|
||||
|
||||
pushd "${tempdir}"
|
||||
|
||||
# Checkout
|
||||
git clone git://sourceware.org/git/elfutils.git
|
||||
cd elfutils
|
||||
git tag --verify "elfutils-${VERSION}"
|
||||
git checkout -b "$VERSION" "elfutils-${VERSION}"
|
||||
|
||||
# Create dist
|
||||
autoreconf -v -f -i
|
||||
./configure --enable-maintainer-mode
|
||||
make -j$(nproc) && make dist
|
||||
|
||||
# Sign
|
||||
mkdir $VERSION
|
||||
cp elfutils-$VERSION.tar.bz2 $VERSION/
|
||||
cd $VERSION/
|
||||
gpg -b elfutils-$VERSION.tar.bz2
|
||||
cd ..
|
||||
|
||||
# Backup copy
|
||||
cp -r $VERSION $HOME/elfutils-$VERSION
|
||||
|
||||
# Upload
|
||||
scp -r $VERSION sourceware.org:/sourceware/ftp/pub/elfutils/
|
||||
ssh sourceware.org "(cd /sourceware/ftp/pub/elfutils \
|
||||
&& chmod go+rx $VERSION \
|
||||
&& chmod go+r $VERSION/elfutils-$VERSION.tar.bz2* \
|
||||
&& ln -sf $VERSION/elfutils-$VERSION.tar.bz2 elfutils-latest.tar.bz2 \
|
||||
&& ln -sf $VERSION/elfutils-$VERSION.tar.bz2.sig elfutils-latest.tar.bz2.sig \
|
||||
&& ls -lah elfutils-latest*)"
|
||||
|
||||
# Cleanup
|
||||
popd
|
||||
trap - EXIT
|
||||
exit
|
||||
+81
-6
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
dnl Configure input file for elfutils. -*-autoconf-*-
|
||||
dnl
|
||||
dnl Copyright (C) 1996-2019 Red Hat, Inc.
|
||||
dnl Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
|
||||
dnl Copyright (C) 2022, 2023 Mark J. Wielaard <mark@klomp.org>
|
||||
dnl
|
||||
dnl This file is part of elfutils.
|
||||
dnl
|
||||
@@ -18,7 +18,7 @@ dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
AC_INIT([elfutils],[0.188],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
|
||||
AC_INIT([elfutils],[0.190],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
|
||||
|
||||
dnl Workaround for older autoconf < 2.64
|
||||
m4_ifndef([AC_PACKAGE_URL],
|
||||
@@ -45,7 +45,7 @@ fi
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_FILES([config/Makefile])
|
||||
|
||||
AC_COPYRIGHT([Copyright (C) 1996-2022 The elfutils developers.])
|
||||
AC_COPYRIGHT([Copyright (C) 1996-2023 The elfutils developers.])
|
||||
AC_PREREQ(2.63) dnl Minimum Autoconf version required.
|
||||
|
||||
dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
|
||||
@@ -155,6 +155,29 @@ AC_SUBST([fpie_CFLAGS])
|
||||
|
||||
dso_LDFLAGS="-shared"
|
||||
|
||||
NO_UNDEFINED=-Wl,--no-undefined
|
||||
AC_ARG_ENABLE([sanitize-memory],
|
||||
AS_HELP_STRING([--enable-sanitize-memory],
|
||||
[Use clang memory sanitizer]),
|
||||
[use_msan=$enableval], [use_msan=no])
|
||||
if test "$use_msan" = yes; then
|
||||
old_CFLAGS="$CFLAGS"
|
||||
old_CXXFLAGS="$CXXFLAGS"
|
||||
old_LDFLAGS="$LDFLAGS"
|
||||
# -fsanitize=memory is not compatible with -D_FORTIFY_SOURCE, -Wl,-z,defs and --no-undefined
|
||||
CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins -D_FORTIFY_SOURCE=0"
|
||||
CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins -D_FORTIFY_SOURCE=0"
|
||||
LDFLAGS="-shared"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([int main (int argc, char **argv) { return 0; }])], use_msan=yes, use_msan=no)
|
||||
AS_IF([test "x$use_msan" = xyes],
|
||||
ac_cv_zdefs=no NO_UNDEFINED=,
|
||||
AC_MSG_WARN([clang memory sanitizer not available])
|
||||
CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS")
|
||||
LDFLAGS="$old_LDFLAGS"
|
||||
fi
|
||||
AC_SUBST(NO_UNDEFINED)
|
||||
AM_CONDITIONAL(USE_MEMORY_SANITIZER, test "$use_msan" = yes)
|
||||
|
||||
ZDEFS_LDFLAGS="-Wl,-z,defs"
|
||||
AC_CACHE_CHECK([whether gcc supports $ZDEFS_LDFLAGS], ac_cv_zdefs, [dnl
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
@@ -420,10 +443,22 @@ AC_SUBST([LIBLZMA])
|
||||
eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
|
||||
AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
|
||||
AC_SUBST([LIBZSTD])
|
||||
zstd_LIBS="$LIBS"
|
||||
AC_SUBST([zstd_LIBS])
|
||||
zip_LIBS="$LIBS"
|
||||
LIBS="$save_LIBS"
|
||||
AC_SUBST([zip_LIBS])
|
||||
|
||||
dnl zstd compression support requires libzstd 1.4.0+
|
||||
AS_IF([test "x$with_zstd" = xyes], [
|
||||
PKG_PROG_PKG_CONFIG
|
||||
PKG_CHECK_MODULES([ZSTD_COMPRESS],[libzstd >= 1.4.0],
|
||||
[with_zstd_compress="yes"],[with_zstd_compress="no"])],
|
||||
[with_zstd_compress="no"])
|
||||
AM_CONDITIONAL(USE_ZSTD_COMPRESS, test "x$with_zstd_compress" = "xyes")
|
||||
AS_IF([test "x$with_zstd_compress" = "xyes"],
|
||||
[AC_DEFINE([USE_ZSTD_COMPRESS], [1], [zstd compression support])])
|
||||
|
||||
AC_CHECK_DECLS([memrchr, rawmemchr],[],[],
|
||||
[#define _GNU_SOURCE
|
||||
#include <string.h>])
|
||||
@@ -443,16 +478,29 @@ AS_IF([test "x$ac_cv_func_mremap" = "xno"],
|
||||
AC_CHECK_HEADERS([error.h])
|
||||
AC_CHECK_HEADERS([err.h])
|
||||
|
||||
dnl for debuginfod concurrency heuristics
|
||||
AC_CHECK_HEADERS([sched.h])
|
||||
AC_CHECK_FUNCS([sched_getaffinity])
|
||||
AC_CHECK_HEADERS([sys/resource.h])
|
||||
AC_CHECK_FUNCS([getrlimit])
|
||||
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
AC_FUNC_STRERROR_R()
|
||||
CFLAGS="$old_CFLAGS"
|
||||
|
||||
AC_ARG_ENABLE([demangler],
|
||||
AS_HELP_STRING([--disable-demangler],
|
||||
[Disable libstdc++ demangle support]),
|
||||
[], [enable_demangler=yes])
|
||||
AS_IF([test "x$enable_demangler" = xyes],
|
||||
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
|
||||
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
|
||||
AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
|
||||
AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
|
||||
[enable_demangler=yes],[enable_demangler=no])
|
||||
[enable_demangler=yes],
|
||||
[AC_MSG_ERROR([[__cxa_demangle not found in libstdc++, use --disable-demangler to disable demangler support.]])]),
|
||||
AM_CONDITIONAL(DEMANGLE, false))
|
||||
|
||||
AC_ARG_ENABLE([textrelcheck],
|
||||
AS_HELP_STRING([--disable-textrelcheck],
|
||||
@@ -570,6 +618,23 @@ CFLAGS="$old_CFLAGS"])
|
||||
AM_CONDITIONAL(HAVE_NO_PACKED_NOT_ALIGNED_WARNING,
|
||||
[test "x$ac_cv_no_packed_not_aligned" != "xno"])
|
||||
|
||||
AC_CACHE_CHECK([whether the compiler accepts -Wuse-after-free=3], ac_cv_use_after_free3, [dnl
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wuse-after-free=3 -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
ac_cv_use_after_free3=yes, ac_cv_use_after_free3=no)
|
||||
CFLAGS="$old_CFLAGS"])
|
||||
AM_CONDITIONAL(HAVE_USE_AFTER_FREE3_WARNING,
|
||||
[test "x$ac_cv_use_after_free3" != "xno"])
|
||||
|
||||
AC_CACHE_CHECK([whether the compiler accepts -fno-addrsig], ac_cv_fno_addrsig, [dnl
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fno-addrsig -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
ac_cv_fno_addrsig=yes, ac_cv_fno_addrsig=no)
|
||||
CFLAGS="$old_CFLAGS"])
|
||||
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([argp_parse], [argp])
|
||||
LIBS="$saved_LIBS"
|
||||
@@ -744,6 +809,11 @@ fi
|
||||
AC_CHECK_PROG(HAVE_ZSTD, zstd, yes, no)
|
||||
AM_CONDITIONAL([HAVE_ZSTD],[test "x$HAVE_ZSTD" = "xyes"])
|
||||
|
||||
# For tests that need to use C++11
|
||||
AX_CXX_COMPILE_STDCXX(11, noext, optional)
|
||||
AS_IF([test "x$HAVE_CXX11" = "x1"], [HAVE_CXX11=yes], [HAVE_CXX11=no])
|
||||
AM_CONDITIONAL([HAVE_CXX11],[test "x$HAVE_CXX11" = "xyes"])
|
||||
|
||||
# Look for libcurl for libdebuginfod minimum version as per rhel7.
|
||||
AC_ARG_ENABLE([libdebuginfod],AS_HELP_STRING([--enable-libdebuginfod], [Build debuginfod client library (can be =dummy)]))
|
||||
AS_IF([test "x$enable_libdebuginfod" != "xno"], [
|
||||
@@ -769,13 +839,15 @@ AS_IF([test "x$enable_libdebuginfod" = "xdummy"],
|
||||
[AC_DEFINE([DUMMY_LIBDEBUGINFOD], [1], [Build dummy libdebuginfod])])
|
||||
AM_CONDITIONAL([LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"])
|
||||
AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xdummy"])
|
||||
AC_CHECK_HEADERS([execinfo.h])
|
||||
|
||||
# Look for libmicrohttpd, libarchive, sqlite for debuginfo server
|
||||
# minimum versions as per rhel7.
|
||||
AC_ARG_ENABLE([debuginfod],AS_HELP_STRING([--enable-debuginfod], [Build debuginfod server]))
|
||||
AS_IF([test "x$enable_debuginfod" != "xno"], [
|
||||
AC_MSG_NOTICE([checking debuginfod C++11 support, --disable-debuginfod to skip])
|
||||
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
if test "x$HAVE_CXX11" = "xno"; then
|
||||
AC_MSG_ERROR([the compiler does not support C++11, use --disable-debuginfod to disable.])
|
||||
fi
|
||||
AC_MSG_NOTICE([checking debuginfod dependencies, --disable-debuginfod to skip])
|
||||
if test "x$enable_libdebuginfod" = "xno"; then
|
||||
AC_MSG_ERROR([need libdebuginfod (or dummy), use --disable-debuginfod to disable.])
|
||||
@@ -829,6 +901,7 @@ AC_MSG_NOTICE([
|
||||
bzip2 support : ${with_bzlib}
|
||||
lzma/xz support : ${with_lzma}
|
||||
zstd support : ${with_zstd}
|
||||
zstd compression support : ${with_zstd_compress}
|
||||
libstdc++ demangle support : ${enable_demangler}
|
||||
File textrel check : ${enable_textrelcheck}
|
||||
Symbol versioning : ${enable_symbol_versioning}
|
||||
@@ -848,12 +921,14 @@ AC_MSG_NOTICE([
|
||||
EXTRA TEST FEATURES (used with make check)
|
||||
have bunzip2 installed (required) : ${HAVE_BUNZIP2}
|
||||
have zstd installed : ${HAVE_ZSTD}
|
||||
C++11 : ${HAVE_CXX11}
|
||||
debug branch prediction : ${use_debugpred}
|
||||
gprof support : ${use_gprof}
|
||||
gcov support : ${use_gcov}
|
||||
run all tests under valgrind : ${use_valgrind}
|
||||
gcc undefined behaviour sanitizer : ${use_undefined}
|
||||
gcc address sanitizer : ${use_address}
|
||||
clang memory sanitizer : ${use_msan}
|
||||
use rpath in tests : ${tests_use_rpath}
|
||||
test biarch : ${utrace_cv_cc_biarch}
|
||||
])
|
||||
|
||||
@@ -1,3 +1,97 @@
|
||||
2023-04-21 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* debuginfod.cxx (groom): Fix -r / -X logic.
|
||||
|
||||
2023-04-13 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* debuginfod.cxx (archive_classify, scan_archive_file): Catch and
|
||||
propagate exceptions during archive scans.
|
||||
|
||||
2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
|
||||
|
||||
* debuginfod-client.c (update_atime): New function.
|
||||
(extract_section, debuginfod_query_server): Call it.
|
||||
|
||||
2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Don't modify
|
||||
atime unintentionally.
|
||||
* debuginfod.cxx (extract_section, handle_buildid_r_match): Ditto.
|
||||
|
||||
2023-03-30 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Avoid sscanf on
|
||||
mixed-case component of string.
|
||||
|
||||
2023-03-29 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): s/futimes/futimens/
|
||||
* debuginfod.cxx (extract_section, handle_buildid_r_match): Ditto.
|
||||
|
||||
2023-03-29 lilydjwg <lilydjwg@gmail.com>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Handle dl_size in
|
||||
progress to account for possible curl 8.0.1 changes to
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD*.
|
||||
|
||||
2023-03-17 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Do not create an
|
||||
empty file in the cache if the query was cancelled by the progressfn.
|
||||
|
||||
2023-02-07 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (cache_find_section): Avoid returning -ENOENT
|
||||
if debuginfo wasn't found.
|
||||
|
||||
2023-02-06 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod.h.in: Guard debuginfod_client typedef with
|
||||
_ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF.
|
||||
|
||||
2023-01-10 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Use
|
||||
CURL_AT_LEAST_VERSION(7.85.0) for CURLOPT_PROTOCOLS_STR.
|
||||
|
||||
2023-01-11 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
PR29975 & PR29976
|
||||
* debuginfod.cxx (default_concurrency): New function to guess a
|
||||
reasonable default for -c/-C on large but constrained machines.
|
||||
|
||||
2022-12-21 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod-client.c: Define CURL_AT_LEAST_VERSION.
|
||||
|
||||
2022-12-21 Andrew Paprocki <andrew@ishiboo.com>
|
||||
|
||||
* debuginfod-client.c: Make compilable against newer curl. PR29926
|
||||
|
||||
2022-11-15 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod-client.c (debuginfod_query_server): Initialize
|
||||
response_data early.
|
||||
|
||||
2022-11-07 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (debuginfod_find_section): Don't treat 0 as an
|
||||
error code.
|
||||
|
||||
2022-11-04 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (debuginfod_find_section): Ensure rc
|
||||
is always updated with the most recent error code.
|
||||
|
||||
2022-11-03 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* debuginfod.cxx (handle_buildid): Correctly manage lifetime
|
||||
of debuginfod_client federation callout object.
|
||||
|
||||
2022-11-02 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod-client.c (extract_section): Mark static.
|
||||
|
||||
2022-11-01 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* debuginfod-client.c (path_escape): Add early return.
|
||||
|
||||
@@ -102,7 +102,8 @@ endif
|
||||
$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
|
||||
-Wl,--soname,$(LIBDEBUGINFOD_SONAME) \
|
||||
-Wl,--version-script,$<,--no-undefined \
|
||||
-Wl,--version-script,$< \
|
||||
$(NO_UNDEFINED) \
|
||||
-Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \
|
||||
$(libdebuginfod_so_LDLIBS)
|
||||
@$(textrel_check)
|
||||
|
||||
+123
-58
@@ -105,6 +105,13 @@ void debuginfod_end (debuginfod_client *c) { }
|
||||
#include <fts.h>
|
||||
#endif
|
||||
|
||||
/* Older curl.h don't define CURL_AT_LEAST_VERSION. */
|
||||
#ifndef CURL_AT_LEAST_VERSION
|
||||
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
|
||||
#define CURL_AT_LEAST_VERSION(x,y,z) \
|
||||
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static pthread_once_t init_control = PTHREAD_ONCE_INIT;
|
||||
@@ -241,7 +248,7 @@ debuginfod_write_callback (char *ptr, size_t size, size_t nmemb, void *data)
|
||||
|
||||
/* handle config file read and write */
|
||||
static int
|
||||
debuginfod_config_cache(char *config_path,
|
||||
debuginfod_config_cache(debuginfod_client *c, char *config_path,
|
||||
long cache_config_default_s,
|
||||
struct stat *st)
|
||||
{
|
||||
@@ -270,17 +277,27 @@ debuginfod_config_cache(char *config_path,
|
||||
}
|
||||
|
||||
long cache_config;
|
||||
/* PR29696 - NB: When using fdopen, the file descriptor is NOT
|
||||
dup'ed and will be closed when the stream is closed. Manually
|
||||
closing fd after fclose is called will lead to a race condition
|
||||
where, if reused, the file descriptor will compete for its
|
||||
regular use before being incorrectly closed here. */
|
||||
FILE *config_file = fdopen(fd, "r");
|
||||
if (config_file)
|
||||
{
|
||||
if (fscanf(config_file, "%ld", &cache_config) != 1)
|
||||
cache_config = cache_config_default_s;
|
||||
fclose(config_file);
|
||||
cache_config = cache_config_default_s;
|
||||
if (0 != fclose (config_file) && c->verbose_fd >= 0)
|
||||
dprintf (c->verbose_fd, "fclose failed with %s (err=%d)\n",
|
||||
strerror (errno), errno);
|
||||
}
|
||||
else
|
||||
cache_config = cache_config_default_s;
|
||||
|
||||
close (fd);
|
||||
{
|
||||
cache_config = cache_config_default_s;
|
||||
if (0 != close (fd) && c->verbose_fd >= 0)
|
||||
dprintf (c->verbose_fd, "close failed with %s (err=%d)\n",
|
||||
strerror (errno), errno);
|
||||
}
|
||||
return cache_config;
|
||||
}
|
||||
|
||||
@@ -296,7 +313,7 @@ debuginfod_clean_cache(debuginfod_client *c,
|
||||
struct stat st;
|
||||
|
||||
/* Create new interval file. */
|
||||
rc = debuginfod_config_cache(interval_path,
|
||||
rc = debuginfod_config_cache(c, interval_path,
|
||||
cache_clean_default_interval_s, &st);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
@@ -309,11 +326,11 @@ debuginfod_clean_cache(debuginfod_client *c,
|
||||
|
||||
/* Update timestamp representing when the cache was last cleaned.
|
||||
Do it at the start to reduce the number of threads trying to do a
|
||||
cleanup simultaniously. */
|
||||
cleanup simultaneously. */
|
||||
utime (interval_path, NULL);
|
||||
|
||||
/* Read max unused age value from config file. */
|
||||
rc = debuginfod_config_cache(max_unused_path,
|
||||
rc = debuginfod_config_cache(c, max_unused_path,
|
||||
cache_default_max_unused_age_s, &st);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
@@ -551,7 +568,9 @@ header_callback (char * buffer, size_t size, size_t numitems, void * userdata)
|
||||
struct handle_data *data = (struct handle_data *) userdata;
|
||||
if (size != 1)
|
||||
return 0;
|
||||
if (data->client && data->client->verbose_fd >= 0)
|
||||
if (data->client
|
||||
&& data->client->verbose_fd >= 0
|
||||
&& numitems > 2)
|
||||
dprintf (data->client->verbose_fd, "header %.*s", (int)numitems, buffer);
|
||||
// Some basic checks to ensure the headers received are of the expected format
|
||||
if (strncasecmp(buffer, "X-DEBUGINFOD", 11)
|
||||
@@ -611,6 +630,19 @@ path_escape (const char *src, char *dest)
|
||||
dest[q] = '\0';
|
||||
}
|
||||
|
||||
/* Attempt to update the atime */
|
||||
static void
|
||||
update_atime (int fd)
|
||||
{
|
||||
struct timespec tvs[2];
|
||||
|
||||
tvs[0].tv_sec = tvs[1].tv_sec = 0;
|
||||
tvs[0].tv_nsec = UTIME_NOW;
|
||||
tvs[1].tv_nsec = UTIME_OMIT;
|
||||
|
||||
(void) futimens (fd, tvs); /* best effort */
|
||||
}
|
||||
|
||||
/* Attempt to read an ELF/DWARF section with name SECTION from FD and write
|
||||
it to a separate file in the debuginfod cache. If successful the absolute
|
||||
path of the separate file containing SECTION will be stored in USR_PATH.
|
||||
@@ -621,7 +653,7 @@ path_escape (const char *src, char *dest)
|
||||
section name was not found. -EEXIST indicates that the section was
|
||||
found but had type SHT_NOBITS. */
|
||||
|
||||
int
|
||||
static int
|
||||
extract_section (int fd, const char *section, char *fd_path, char **usr_path)
|
||||
{
|
||||
elf_version (EV_CURRENT);
|
||||
@@ -754,6 +786,7 @@ extract_section (int fd, const char *section, char *fd_path, char **usr_path)
|
||||
*usr_path = sec_path;
|
||||
else
|
||||
free (sec_path);
|
||||
update_atime(fd);
|
||||
rc = sec_fd;
|
||||
goto out2;
|
||||
}
|
||||
@@ -778,23 +811,24 @@ out:
|
||||
an ELF/DWARF section with name SCN_NAME. If found, extract the section
|
||||
to a separate file in TARGET_CACHE_DIR and return a file descriptor
|
||||
for the section file. The path for this file will be stored in USR_PATH.
|
||||
Return a negative errno if unsuccessful. */
|
||||
Return a negative errno if unsuccessful. -ENOENT indicates that SCN_NAME
|
||||
is confirmed to not exist. */
|
||||
|
||||
static int
|
||||
cache_find_section (const char *scn_name, const char *target_cache_dir,
|
||||
char **usr_path)
|
||||
{
|
||||
int fd;
|
||||
int debug_fd;
|
||||
int rc = -EEXIST;
|
||||
char parent_path[PATH_MAX];
|
||||
|
||||
/* Check the debuginfo first. */
|
||||
snprintf (parent_path, PATH_MAX, "%s/debuginfo", target_cache_dir);
|
||||
fd = open (parent_path, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
debug_fd = open (parent_path, O_RDONLY);
|
||||
if (debug_fd >= 0)
|
||||
{
|
||||
rc = extract_section (fd, scn_name, parent_path, usr_path);
|
||||
close (fd);
|
||||
rc = extract_section (debug_fd, scn_name, parent_path, usr_path);
|
||||
close (debug_fd);
|
||||
}
|
||||
|
||||
/* If the debuginfo file couldn't be found or the section type was
|
||||
@@ -802,12 +836,17 @@ cache_find_section (const char *scn_name, const char *target_cache_dir,
|
||||
if (rc == -EEXIST)
|
||||
{
|
||||
snprintf (parent_path, PATH_MAX, "%s/executable", target_cache_dir);
|
||||
fd = open (parent_path, O_RDONLY);
|
||||
int exec_fd = open (parent_path, O_RDONLY);
|
||||
|
||||
if (fd >= 0)
|
||||
if (exec_fd >= 0)
|
||||
{
|
||||
rc = extract_section (fd, scn_name, parent_path, usr_path);
|
||||
close (fd);
|
||||
rc = extract_section (exec_fd, scn_name, parent_path, usr_path);
|
||||
close (exec_fd);
|
||||
|
||||
/* Don't return -ENOENT if the debuginfo wasn't opened. The
|
||||
section may exist in the debuginfo but not the executable. */
|
||||
if (debug_fd < 0 && rc == -ENOENT)
|
||||
rc = -EREMOTE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,6 +1124,7 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
}
|
||||
}
|
||||
/* Success!!!! */
|
||||
update_atime(fd);
|
||||
rc = fd;
|
||||
goto out;
|
||||
}
|
||||
@@ -1097,7 +1137,7 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
|
||||
close(fd); /* no need to hold onto the negative-hit file descriptor */
|
||||
|
||||
rc = debuginfod_config_cache(cache_miss_path,
|
||||
rc = debuginfod_config_cache(c, cache_miss_path,
|
||||
cache_miss_default_s, &st);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
@@ -1250,6 +1290,8 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
data[i].handle = NULL;
|
||||
data[i].fd = -1;
|
||||
data[i].errbuf[0] = '\0';
|
||||
data[i].response_data = NULL;
|
||||
data[i].response_data_size = 0;
|
||||
}
|
||||
|
||||
char *escaped_string = NULL;
|
||||
@@ -1327,8 +1369,13 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
|
||||
/* Only allow http:// + https:// + file:// so we aren't being
|
||||
redirected to some unsupported protocol. */
|
||||
#if CURL_AT_LEAST_VERSION(7, 85, 0)
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR,
|
||||
"http,https,file");
|
||||
#else
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS,
|
||||
(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
|
||||
#endif
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url);
|
||||
if (vfd >= 0)
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_ERRORBUFFER,
|
||||
@@ -1346,8 +1393,6 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
curl_easy_setopt_ck (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
|
||||
100 * 1024L);
|
||||
}
|
||||
data[i].response_data = NULL;
|
||||
data[i].response_data_size = 0;
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_FILETIME, (long) 1);
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
|
||||
curl_easy_setopt_ck(data[i].handle, CURLOPT_FAILONERROR, (long) 1);
|
||||
@@ -1449,14 +1494,14 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
goto out2;
|
||||
}
|
||||
|
||||
long dl_size = 0;
|
||||
long dl_size = -1;
|
||||
if (target_handle && (c->progressfn || maxsize > 0))
|
||||
{
|
||||
/* Get size of file being downloaded. NB: If going through
|
||||
deflate-compressing proxies, this number is likely to be
|
||||
unavailable, so -1 may show. */
|
||||
CURLcode curl_res;
|
||||
#ifdef CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
|
||||
#if CURL_AT_LEAST_VERSION(7, 55, 0)
|
||||
curl_off_t cl;
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
@@ -1468,7 +1513,7 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD,
|
||||
&cl);
|
||||
if (curl_res == CURLE_OK)
|
||||
if (curl_res == CURLE_OK && cl >= 0)
|
||||
dl_size = (cl >= (double)(LONG_MAX+1UL) ? LONG_MAX : (long)cl);
|
||||
#endif
|
||||
/* If Content-Length is -1, try to get the size from
|
||||
@@ -1477,9 +1522,9 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
{
|
||||
long xdl;
|
||||
char *hdr = strcasestr(c->winning_headers, "x-debuginfod-size");
|
||||
size_t off = strlen("x-debuginfod-size:");
|
||||
|
||||
if (hdr != NULL
|
||||
&& sscanf(hdr, "x-debuginfod-size: %ld", &xdl) == 1)
|
||||
if (hdr != NULL && sscanf(hdr + off, "%ld", &xdl) == 1)
|
||||
dl_size = xdl;
|
||||
}
|
||||
}
|
||||
@@ -1490,26 +1535,40 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
long pa = loops; /* default param for progress callback */
|
||||
if (target_handle) /* we've committed to a server; report its download progress */
|
||||
{
|
||||
CURLcode curl_res;
|
||||
#ifdef CURLINFO_SIZE_DOWNLOAD_T
|
||||
curl_off_t dl;
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_SIZE_DOWNLOAD_T,
|
||||
&dl);
|
||||
if (curl_res == 0 && dl >= 0)
|
||||
pa = (dl > LONG_MAX ? LONG_MAX : (long)dl);
|
||||
/* PR30809: Check actual size of cached file. This same
|
||||
fd is shared by all the multi-curl handles (but only
|
||||
one will end up writing to it). Another way could be
|
||||
to tabulate totals in debuginfod_write_callback(). */
|
||||
struct stat cached;
|
||||
int statrc = fstat(fd, &cached);
|
||||
if (statrc == 0)
|
||||
pa = (long) cached.st_size;
|
||||
else
|
||||
{
|
||||
/* Otherwise, query libcurl for its tabulated total.
|
||||
However, that counts http body length, not
|
||||
decoded/decompressed content length, so does not
|
||||
measure quite the same thing as dl. */
|
||||
CURLcode curl_res;
|
||||
#if CURL_AT_LEAST_VERSION(7, 55, 0)
|
||||
curl_off_t dl;
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_SIZE_DOWNLOAD_T,
|
||||
&dl);
|
||||
if (curl_res == 0 && dl >= 0)
|
||||
pa = (dl > LONG_MAX ? LONG_MAX : (long)dl);
|
||||
#else
|
||||
double dl;
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_SIZE_DOWNLOAD,
|
||||
&dl);
|
||||
if (curl_res == 0)
|
||||
pa = (dl >= (double)(LONG_MAX+1UL) ? LONG_MAX : (long)dl);
|
||||
double dl;
|
||||
curl_res = curl_easy_getinfo(target_handle,
|
||||
CURLINFO_SIZE_DOWNLOAD,
|
||||
&dl);
|
||||
if (curl_res == 0)
|
||||
pa = (dl >= (double)(LONG_MAX+1UL) ? LONG_MAX : (long)dl);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ((*c->progressfn) (c, pa, dl_size))
|
||||
if ((*c->progressfn) (c, pa, dl_size == -1 ? 0 : dl_size))
|
||||
{
|
||||
c->progressfn_cancel = true;
|
||||
break;
|
||||
@@ -1649,9 +1708,9 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
}
|
||||
} while (num_msg > 0);
|
||||
|
||||
/* Create an empty file named as $HOME/.cache if the query fails
|
||||
with ENOENT.*/
|
||||
if (rc == -ENOENT)
|
||||
/* Create an empty file in the cache if the query fails with ENOENT and
|
||||
it wasn't cancelled early. */
|
||||
if (rc == -ENOENT && !c->progressfn_cancel)
|
||||
{
|
||||
int efd = open (target_cache_path, O_CREAT|O_EXCL, DEFFILEMODE);
|
||||
if (efd >= 0)
|
||||
@@ -1700,13 +1759,15 @@ debuginfod_query_server (debuginfod_client *c,
|
||||
#else
|
||||
CURLcode curl_res = curl_easy_getinfo(verified_handle, CURLINFO_FILETIME, (void*) &mtime);
|
||||
#endif
|
||||
if (curl_res != CURLE_OK)
|
||||
mtime = time(NULL); /* fall back to current time */
|
||||
|
||||
struct timeval tvs[2];
|
||||
tvs[0].tv_sec = tvs[1].tv_sec = mtime;
|
||||
tvs[0].tv_usec = tvs[1].tv_usec = 0;
|
||||
(void) futimes (fd, tvs); /* best effort */
|
||||
if (curl_res == CURLE_OK)
|
||||
{
|
||||
struct timespec tvs[2];
|
||||
tvs[0].tv_sec = 0;
|
||||
tvs[0].tv_nsec = UTIME_OMIT;
|
||||
tvs[1].tv_sec = mtime;
|
||||
tvs[1].tv_nsec = 0;
|
||||
(void) futimens (fd, tvs); /* best effort */
|
||||
}
|
||||
|
||||
/* PR27571: make cache files casually unwriteable; dirs are already 0700 */
|
||||
(void) fchmod(fd, 0400);
|
||||
@@ -1936,7 +1997,7 @@ debuginfod_find_section (debuginfod_client *client,
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
{
|
||||
rc = extract_section (fd, section, tmp_path, path);
|
||||
close (fd);
|
||||
@@ -1944,14 +2005,18 @@ debuginfod_find_section (debuginfod_client *client,
|
||||
|
||||
if (rc == -EEXIST)
|
||||
{
|
||||
/* The section should be found in the executable. */
|
||||
/* Either the debuginfo couldn't be found or the section should
|
||||
be in the executable. */
|
||||
fd = debuginfod_find_executable (client, build_id,
|
||||
build_id_len, &tmp_path);
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
{
|
||||
rc = extract_section (fd, section, tmp_path, path);
|
||||
close (fd);
|
||||
}
|
||||
else
|
||||
/* Update rc so that we return the most recent error code. */
|
||||
rc = fd;
|
||||
}
|
||||
|
||||
free (tmp_path);
|
||||
|
||||
+486
-179
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,10 @@
|
||||
#define DEBUGINFOD_SONAME "@LIBDEBUGINFOD_SONAME@"
|
||||
|
||||
/* Handle for debuginfod-client connection. */
|
||||
#ifndef _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF
|
||||
typedef struct debuginfod_client debuginfod_client;
|
||||
#define _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2023-02-14 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* debuginfod.8: Add .TP before -g.
|
||||
|
||||
2023-01-11 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* debuginfod.8: Tweak -c/-C documentation for heuristic defaults.
|
||||
|
||||
2022-10-31 Aaron Merey <amerey@redhat.com>
|
||||
|
||||
* Makefile.am (notrans_dist_man3_MANS): Add debuginfod_find_section.3.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
EXTRA_DIST = COPYING-GFDL README
|
||||
dist_man1_MANS=readelf.1 elfclassify.1
|
||||
dist_man1_MANS=readelf.1 elfclassify.1 srcfiles.1
|
||||
notrans_dist_man3_MANS=elf_update.3 elf_getdata.3 elf_clone.3 elf_begin.3
|
||||
notrans_dist_man7_MANS=
|
||||
notrans_dist_man8_MANS=
|
||||
|
||||
@@ -92,6 +92,19 @@ is made up of multiple CUs. Therefore, to disambiguate, debuginfod
|
||||
expects source queries to prefix relative path names with the CU
|
||||
compilation-directory, followed by a mandatory "/".
|
||||
|
||||
Note: for software packaged by distributions, the CU
|
||||
compilation-directory may not be obvious. It can be found by
|
||||
inspecting AT_comp_dir values in downloaded debuginfo. For example,
|
||||
the comp_dir of the Fedora 37 version of /bin/ls can be found as
|
||||
follows:
|
||||
|
||||
.SAMPLE
|
||||
% debuginfod-find debuginfo /bin/ls
|
||||
~/.cache/debuginfod_client/03529d48345409576cd5c82a56ad08555088d353/
|
||||
% eu-readelf -w ~/.cache/debuginfod_client/03529d48345409576cd5c82a56ad08555088d353/debuginfo | grep comp_dir
|
||||
comp_dir (line_strp) "/usr/src/debug/coreutils-9.1-6.fc37.x86_64/separate"
|
||||
.ESAMPLE
|
||||
|
||||
Note: the caller may or may not elide \fB../\fP or \fB/./\fP or extraneous
|
||||
\fB///\fP sorts of path components in the directory names. debuginfod
|
||||
accepts both forms. Specifically, debuginfod canonicalizes path names
|
||||
|
||||
+58
-22
@@ -172,8 +172,12 @@ interrupting a groom pass (if any).
|
||||
|
||||
.TP
|
||||
.B "\-r"
|
||||
Apply the -I and -X during groom cycles, so that files excluded by the regexes are removed from the index. These parameters are in addition to what normally qualifies a file for grooming, not a replacement.
|
||||
Apply the -I and -X during groom cycles, so that most content related
|
||||
to files excluded by the regexes are removed from the index. Not all
|
||||
content can be practically removed, so eventually a "\-G"
|
||||
"maximal-groom" operation may be needed.
|
||||
|
||||
.TP
|
||||
.B "\-g SECONDS" "\-\-groom\-time=SECONDS"
|
||||
Set the groom time for the index database. This is the amount of time
|
||||
the grooming thread will wait after finishing a grooming pass before
|
||||
@@ -202,8 +206,9 @@ do maximal-grooming. See also the \fIDATA MANAGEMENT\fP section.
|
||||
Set the concurrency limit for the scanning queue threads, which work
|
||||
together to process archives & files located by the traversal thread.
|
||||
This important for controlling CPU-intensive operations like parsing
|
||||
an ELF file and especially decompressing archives. The default is the
|
||||
number of processors on the system; the minimum is 1.
|
||||
an ELF file and especially decompressing archives. The default is
|
||||
related to the number of processors on the system and other
|
||||
constraints; the minimum is 1.
|
||||
|
||||
.TP
|
||||
.B "\-C" "\-C=NUM" "\-\-connection\-pool" "\-\-connection\-pool=NUM"
|
||||
@@ -216,9 +221,9 @@ no option, \-C use a fixed thread pool sized automatically
|
||||
\-C=NUM use a fixed thread pool sized NUM, minimum 2
|
||||
.TE
|
||||
|
||||
The first mode is a simple and safe configuration based on the number
|
||||
of processors. The second mode is suitable for tuned load-limiting
|
||||
configurations facing unruly traffic.
|
||||
The first mode is a simple and safe configuration related to the
|
||||
number of processors and other constraints. The second mode is
|
||||
suitable for tuned load-limiting configurations facing unruly traffic.
|
||||
|
||||
.TP
|
||||
.B "\-L"
|
||||
@@ -277,6 +282,13 @@ Disable scan of the dwarf source info of debuginfo sections.
|
||||
If a setup has no access to source code, the source info is not
|
||||
required.
|
||||
|
||||
.TP
|
||||
.B "\-\-scan\-checkpoint=NUM"
|
||||
Run a synchronized SQLITE WAL checkpoint operation after every NUM
|
||||
completed archive or file scans. This may slow down parallel scanning
|
||||
phase somewhat, but generate much smaller "-wal" temporary files on
|
||||
busy servers. The default is 256. Disabled if 0.
|
||||
|
||||
.TP
|
||||
.B "\-v"
|
||||
Increase verbosity of logging to the standard error file descriptor.
|
||||
@@ -292,18 +304,35 @@ Unknown buildid / request combinations result in HTTP error codes.
|
||||
This file service resemblance is intentional, so that an installation
|
||||
can take advantage of standard HTTP management infrastructure.
|
||||
|
||||
Upon finding a file in an archive or simply in the database, some
|
||||
custom http headers are added to the response. For files in the
|
||||
database X-DEBUGINFOD-FILE and X-DEBUGINFOD-SIZE are added.
|
||||
X-DEBUGINFOD-FILE is simply the unescaped filename and
|
||||
X-DEBUGINFOD-SIZE is the size of the file. For files found in archives,
|
||||
in addition to X-DEBUGINFOD-FILE and X-DEBUGINFOD-SIZE,
|
||||
X-DEBUGINFOD-ARCHIVE is added. X-DEBUGINFOD-ARCHIVE is the name of the
|
||||
archive the file was found in.
|
||||
For most queries, some custom http headers are added to the response,
|
||||
providing additional metadata about the buildid-related response. For example:
|
||||
|
||||
There are three requests. In each case, the buildid is encoded as a
|
||||
lowercase hexadecimal string. For example, for a program \fI/bin/ls\fP,
|
||||
look at the ELF note GNU_BUILD_ID:
|
||||
.SAMPLE
|
||||
% debuginfod-find -v debuginfo /bin/ls |& grep -i x-debuginfo
|
||||
x-debuginfod-size: 502024
|
||||
x-debuginfod-archive: /mnt/fedora_koji_prod/koji/packages/coreutils/9.3/4.fc39/x86_64/coreutils-debuginfo-9.3-4.fc39.x86_64.rpm
|
||||
x-debuginfod-file: /usr/lib/debug/usr/bin/ls-9.3-4.fc39.x86_64.debug
|
||||
.ESAMPLE
|
||||
|
||||
.TP
|
||||
X-DEBUGINFOD-SIZE
|
||||
The size of the file, in bytes. This may differ from the http Content-Length:
|
||||
field (if present), due to compression in transit.
|
||||
|
||||
.TP
|
||||
X-DEBUGINFOD-FILE
|
||||
The full path name of the file related to the given buildid.
|
||||
|
||||
.TP
|
||||
X-DEBUGINFOD-ARCHIVE
|
||||
The full path name of the archive that contained the above file, if any.
|
||||
|
||||
|
||||
|
||||
|
||||
There are a handful of buildid-related requests. In each case, the
|
||||
buildid is encoded as a lowercase hexadecimal string. For example,
|
||||
for a program \fI/bin/ls\fP, look at the ELF note GNU_BUILD_ID:
|
||||
|
||||
.SAMPLE
|
||||
% readelf -n /bin/ls | grep -A4 build.id
|
||||
@@ -370,7 +399,7 @@ extract the contents of an ELF/DWARF section named SECTION from the
|
||||
debuginfo file matching BUILDID. If the debuginfo file can't be found
|
||||
or the section has type SHT_NOBITS, then the server will attempt to extract
|
||||
the section from the executable matching BUILDID. If the section is
|
||||
succesfully extracted then this request results in a binary object
|
||||
successfully extracted then this request results in a binary object
|
||||
of the section's contents. Note that this result is the raw binary
|
||||
contents of the section, not an ELF file.
|
||||
|
||||
@@ -379,8 +408,7 @@ contents of the section, not an ELF file.
|
||||
This endpoint returns a Prometheus formatted text/plain dump of a
|
||||
variety of statistics about the operation of the debuginfod server.
|
||||
The exact set of metrics and their meanings may change in future
|
||||
versions. Caution: configuration information (path names, versions)
|
||||
may be disclosed.
|
||||
versions.
|
||||
|
||||
.SH DATA MANAGEMENT
|
||||
|
||||
@@ -473,8 +501,16 @@ a denial-of-service in terms of RAM, CPU, disk I/O, or network I/O.
|
||||
If this is a problem, users are advised to install debuginfod with a
|
||||
HTTPS reverse-proxy front-end that enforces site policies for
|
||||
firewalling, authentication, integrity, authorization, and load
|
||||
control. The \fI/metrics\fP webapi endpoint is probably not
|
||||
appropriate for disclosure to the public.
|
||||
control.
|
||||
|
||||
Front-end proxies may elide sensitive path name components in
|
||||
X-DEBUGINFOD-FILE/ARCHIVE response headers. For example, using Apache
|
||||
httpd's \fBmod_headers\fP, you can remove the entire directory name
|
||||
prefix:
|
||||
|
||||
.SAMPLE
|
||||
Header edit x-debuginfod-archive ".*/" ""
|
||||
.ESAMPLE
|
||||
|
||||
When relaying queries to upstream debuginfods, debuginfod \fBdoes not\fP
|
||||
include any particular security features. It trusts that the binaries
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
.so man3/debuginfod_find_debuginfo.3
|
||||
|
||||
@@ -1,444 +0,0 @@
|
||||
<!doctype book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
|
||||
<!ENTITY package "<filename>new-bu</filename>">
|
||||
]>
|
||||
|
||||
<book>
|
||||
<title>New Binutils User's and Reference Manual</title>
|
||||
|
||||
<chapter>
|
||||
<title><filename>libelf</filename> <acronym>ABI</acronym></title>
|
||||
|
||||
<simpara>The <acronym>ABI</acronym> of the
|
||||
<filename>libelf</filename> implemented in the &package; package
|
||||
is following that of Sun's implementation which in turn in derived
|
||||
from the original SysVr4 implementation. There are some
|
||||
extensions over Sun's versions, though, which makes it impossible
|
||||
to replace this implementation with Sun's.</simpara>
|
||||
|
||||
<beginpage>
|
||||
|
||||
<refentry xreflabel="Elf_Data" id="ElfUData">
|
||||
<refnamediv>
|
||||
<refname>Elf_Data</refname>
|
||||
<refpurpose>Descriptor for Data Buffer</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
#include <libelf.h>
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<simpara>The <structname>Elf_Data</structname> structure is as
|
||||
a descriptor for a data buffer associated with a section.
|
||||
Every data buffer is associated with a specific section (see
|
||||
<!-- xref --><structname>Elf_Scn</structname>).</simpara>
|
||||
|
||||
<simpara>A data buffer is created when reading a file. In
|
||||
this case only a single buffer is present in the section. The
|
||||
user can add as many sections as wanted to a section and they
|
||||
can be retrieved using the <function>elf_getdata</function>
|
||||
and <function>elf_rawdata</function> functions.<!-- xref
|
||||
--></simpara>
|
||||
|
||||
<simpara>The <structname>Elf_Data</structname> structure
|
||||
contains the following members:</simpara>
|
||||
|
||||
<programlisting>
|
||||
void *d_buf
|
||||
Elf_Type d_type
|
||||
size_t d_size
|
||||
off_t d_off
|
||||
size_t d_align
|
||||
unsigned int d_version
|
||||
</programlisting>
|
||||
|
||||
<simpara>All of these members can be modified directly by the
|
||||
user. They can be used to resize a section, to change its
|
||||
content or type, and many more tasks. This is also true for
|
||||
the data read from a file. The meaning of each member is as
|
||||
follows:</simpara>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><structfield>d_buf</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_buf</structfield> member is
|
||||
the pointer to the buffer with the actual data. When
|
||||
the ELF file was read from a file the first and only
|
||||
data buffer of a section is allocated by the
|
||||
<filename>libelf</filename> library. The user should
|
||||
not try to resize or free this buffer. When the user
|
||||
adds a new data buffer to a section the associated
|
||||
memory block is normally allocated by the user. It is
|
||||
important that the buffer must have a lifetime at least
|
||||
until the ELF file is closed entirely (important when
|
||||
the buffer is allocated on the stack). If the buffer is
|
||||
not allocated on the stack it is the user's
|
||||
responsibility to free the buffer after it is not used
|
||||
anymore. The <structfield>d_buf</structfield> member
|
||||
can contain a null pointer if the data buffer is
|
||||
empty.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><structfield>d_type</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_type</structfield>
|
||||
determines how the data of the buffer is interpreted.
|
||||
This type is determined from the section type and must
|
||||
be the same for all data buffers for a section. See
|
||||
<!-- xref --><type>Elf_Type</type> for more information.
|
||||
The <function><link linkend="elfUgetdata"
|
||||
endterm="elfUgetdata.refname"></link></function>
|
||||
function uses this information to convert the data of
|
||||
the buffer between the external form and the form
|
||||
represented to the user and back if necessary.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><structfield>d_version</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_version</structfield>
|
||||
contains the ELF version of the file.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><structfield>d_size</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_size</structfield> contains
|
||||
the size of the buffer in bytes.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><structfield>d_off</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_off</structfield> is the
|
||||
offset into the section in bytes.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><structfield>d_align</structfield></term>
|
||||
<listitem>
|
||||
<simpara>The <structfield>d_align</structfield> is the
|
||||
address alignment of the section in bytes.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<beginpage>
|
||||
|
||||
<refentry id="elfUgetdata">
|
||||
<refnamediv>
|
||||
<refname id="elfUgetdata.refname">elf_getdata</refname>
|
||||
<refpurpose>Get washed data of section</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>
|
||||
#include <libelf.h>
|
||||
</funcsynopsisinfo>
|
||||
<funcprototype>
|
||||
<funcdef>Elf_Data *<function>elf_getdata</function></funcdef>
|
||||
<paramdef>Elf_Scn *<parameter>scn</parameter></paramdef>
|
||||
<paramdef>Elf_Data *<parameter>data</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<simpara>The <function>elf_getdata</function> function allows
|
||||
the user to retrieve the data buffers of the section
|
||||
<parameter>scn</parameter>. There can be more than one buffer
|
||||
if the user explicitly added them. When a file is read the
|
||||
<filename>libelf</filename> library creates exactly one data
|
||||
buffer.</simpara>
|
||||
|
||||
<simpara>The first buffer in the list can be obtained by
|
||||
passing a null pointer in the parameter
|
||||
<parameter>data</parameter>. To get the next data buffer the
|
||||
previously returned value must be passed in the
|
||||
<parameter>data</parameter> parameter. If there are no more
|
||||
buffer left in the list a null pointer is returned.</simpara>
|
||||
|
||||
<simpara>If the <parameter>data</parameter> parameter is not a
|
||||
null pointer it must be a descriptor for a buffer
|
||||
associated with the section <parameter>scn</parameter>. If
|
||||
this is not the case a null pointer is returned. To
|
||||
facilitate error handling <function>elf_getdata</function>
|
||||
also returns a null pointer if the <parameter>scn</parameter>
|
||||
parameter is a null pointer.</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry>
|
||||
<refnamediv>
|
||||
<refname id="elfUupdate.refname">elf_update</refname>
|
||||
<refpurpose>update an ELF descriptor</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>
|
||||
#include <libelf.h>
|
||||
</funcsynopsisinfo>
|
||||
<funcprototype>
|
||||
<funcdef>off_t <function>elf_update</function></funcdef>
|
||||
<paramdef>Elf *<parameter>elf</parameter></paramdef>
|
||||
<paramdef>Elf_Cmd <parameter>cmd</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<simpara>The user is responsible for filling in the following
|
||||
fields in the named data structures:</simpara>
|
||||
|
||||
<table>
|
||||
<title>Fields not set by <function>elf_update</function></title>
|
||||
<tgroup cols="3">
|
||||
<colspec colwidth="90pt">
|
||||
<colspec colwidth="110pt">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Data Structure</entry>
|
||||
<entry>Member</entry>
|
||||
<entry>Exception</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry morerows="8"><type>Elfxx_Ehdr</type></entry>
|
||||
<entry>e_ident[EI_DATA]</entry>
|
||||
<entry>see below</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_type</entry>
|
||||
<!-- <entry morerows="1"></entry> -->
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_machine</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_version</entry>
|
||||
<entry>see below</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_entry</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_phoff</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_shoff</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_flags</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>e_shstrndx</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry morerows="7">Elfxx_Phdr</entry>
|
||||
<entry>p_type</entry>
|
||||
<entry morerows="7"></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_offset</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_vaddr</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_paddr</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_filesz</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_memsz</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_flags</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>p_align</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry morerows="9">Elfxx_Shdr</entry>
|
||||
<entry>sh_name</entry>
|
||||
<entry morerows="3"></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_type</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_flags</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_addr</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_offset</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_size</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_link</entry>
|
||||
<!-- <entry morerows="1"></entry> -->
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_info</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_addralign</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>sh_entsize</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry morerows="5">Elf_Data</entry>
|
||||
<entry>d_buf</entry>
|
||||
<entry morerows="2"></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>d_type</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>d_size</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>d_off</entry>
|
||||
<entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>d_align</entry>
|
||||
<!-- <entry morerows="1"></entry> -->
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>d_version</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<simpara>Two fields of the ELF header are handled in a special
|
||||
way:</simpara>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>e_version</term>
|
||||
<listitem>
|
||||
<simpara>The user can set this field to the vvalue for
|
||||
the version to be used. It is an error if the library
|
||||
cannot handle this version. If the field contains the
|
||||
value <symbol>EV_NONE</symbol> the library will fill in
|
||||
its own internal version.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>e_ident[EI_DATA]</term>
|
||||
<listitem>
|
||||
<simpara>The user should fill in the byte ordering for
|
||||
the file. If the value of the field is
|
||||
<symbol>ELFDATANONE</symbol> the library replaces it
|
||||
with the native byte ordering for the machine.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
<title><filename>libelf</filename> Internals</title>
|
||||
|
||||
<simpara>Since the binary format handling tools need constant
|
||||
attention since there are always new machines and variants
|
||||
therefore coming out it is important to have the implementation
|
||||
well documented. Only this way extensions can be made in the
|
||||
right places and the mistakes of the past avoided.</simpara>
|
||||
</chapter>
|
||||
</book>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omitag:nil
|
||||
sgml-shorttag:t
|
||||
End:
|
||||
-->
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
.\" Copyright 2023 Red Hat Inc.
|
||||
.\" Mon 2023-Sept 23 Housam Alamour <halamour@redhat.com>
|
||||
.\" Contact elfutils-devel@sourceware.org to correct errors or typos.
|
||||
.TH EU-SRCFILES 1 "2023-Sept-25" "elfutils"
|
||||
|
||||
.de SAMPLE
|
||||
.br
|
||||
.RS 0
|
||||
.nf
|
||||
.nh
|
||||
\fB
|
||||
..
|
||||
.de ESAMPLE
|
||||
\fP
|
||||
.hy
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
|
||||
.SH "NAME"
|
||||
eu-srcfiles \- Lists the source files of a DWARF/ELF file.
|
||||
|
||||
.SH "SYNOPSIS"
|
||||
eu-srcfiles [\fB\-0\fR|\fB\-\-null\fR] [\fB\-c\fR|\fB\-\-cu\-only\fR] [\fB\-v\fR|\fB\-\-verbose\fR] INPUT
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBeu-srcfiles\fR lists the source files of a given \s-DWARF/ELF\s0
|
||||
file. This list is based on a search of the DWARF debuginfo, which
|
||||
may be automatically fetched by debuginfod if applicable. The target
|
||||
file may be an executable, a coredump, a process, or even the running
|
||||
kernel. The default is the file 'a.out'. The source file names are
|
||||
made unique and printed to standard output.
|
||||
|
||||
.SH "INPUT OPTIONS"
|
||||
The long and short forms of options, shown here as alternatives, are
|
||||
equivalent.
|
||||
.TP
|
||||
\fB--core=COREFILE\fR
|
||||
Find addresses from signatures found in COREFILE.
|
||||
|
||||
.TP
|
||||
\fB--debuginfo-path=PATH\fR
|
||||
Search path for separate debuginfo files.
|
||||
|
||||
.TP
|
||||
\fB-e FILE\fR, \fB--executable=FILE\fR
|
||||
Find addresses in FILE.
|
||||
|
||||
.TP
|
||||
\fB-k\fR, \fB--kernel\fR
|
||||
Find addresses in the running kernel.
|
||||
|
||||
.TP
|
||||
\fB-K\fR, \fB--offline-kernel[=RELEASE]\fR
|
||||
Kernel with all modules.
|
||||
|
||||
.TP
|
||||
\fB-M FILE\fR, \fB--linux-process-map=FILE\fR
|
||||
Find addresses in files mapped as read from FILE in Linux /proc/PID/maps format.
|
||||
|
||||
.TP
|
||||
\fB-p PID\fR, \fB--pid=PID\fR
|
||||
Find addresses in files mapped into process PID.
|
||||
|
||||
.TP
|
||||
\fB-?\fR, \fB--help\fR
|
||||
Give this help list.
|
||||
|
||||
.TP
|
||||
\fB--usage\fR
|
||||
Give a short usage message.
|
||||
|
||||
.TP
|
||||
\fB-V\fR, \fB--version\fR
|
||||
Print program version.
|
||||
|
||||
.SH "OUTPUT OPTIONS"
|
||||
|
||||
.TP
|
||||
\fB\-0, \-\-null\fR
|
||||
Separate items by a null instead of a newline.
|
||||
|
||||
.TP
|
||||
\fB\-c, \-\-cu\-only\fR
|
||||
Only list the CU names.
|
||||
|
||||
.TP
|
||||
\fB\-v, \-\-verbose\fR
|
||||
Increase verbosity of logging messages.
|
||||
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
List all source files for a binary.
|
||||
.SAMPLE
|
||||
eu-srcfiles -e /bin/ls
|
||||
.ESAMPLE
|
||||
|
||||
List all compilation units (CU) names for a given process (including shared libraries).
|
||||
.SAMPLE
|
||||
eu-srcfiles -c -p $$
|
||||
.ESAMPLE
|
||||
|
||||
List source files of a binary based on its buildid, using debuginfod.
|
||||
.SAMPLE
|
||||
binary=`debuginfod-find executable 9c22d8d9e42bd051ffdc1064fdfd456ba781c629`
|
||||
eu-srcfiles -c -e $binary
|
||||
.ESAMPLE
|
||||
|
||||
Show the source code of the first CU of a shared library.
|
||||
.SAMPLE
|
||||
binary=/usr/lib64/libc.so.6
|
||||
srcfile=`eu-srcfiles -c -e $binary | head -1`
|
||||
cat `debuginfod-find source $binary $srcfile`
|
||||
.ESAMPLE
|
||||
|
||||
List the source files of a kernel image.
|
||||
.SAMPLE
|
||||
eu-srcfiles -e /boot/vmlinuz-`uname -r`
|
||||
.ESAMPLE
|
||||
|
||||
|
||||
.SH "AUTHOR"
|
||||
Written by Housam Alamour.
|
||||
|
||||
.SH "REPORTING BUGS"
|
||||
Please reports bugs at https://sourceware.org/bugzilla/
|
||||
|
||||
.SH "COPYRIGHT"
|
||||
Copyright (c) 2023 Red Hat Inc. License GPLv3+: GNU GPL version 3 or
|
||||
later <https://gnu.org/licenses/gpl.html>. This is free software: you
|
||||
are free to change and redistribute it. There is NO WARRANTY, to the
|
||||
extent permitted by law.
|
||||
@@ -1 +0,0 @@
|
||||
../../libdwfl/libdwfl.h
|
||||
@@ -1,3 +1,7 @@
|
||||
2022-12-20 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* Makefile.am (xmalloc_CFLAGS): Remove.
|
||||
|
||||
2022-09-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* color.c: Don't include unistd.h.
|
||||
|
||||
@@ -41,7 +41,3 @@ noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \
|
||||
eu-config.h color.h printversion.h bpf.h \
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h
|
||||
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
|
||||
|
||||
if !GPROF
|
||||
xmalloc_CFLAGS = -ffunction-sections
|
||||
endif
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
static size_t
|
||||
lookup (NAME *htab, HASHTYPE hval)
|
||||
{
|
||||
/* First hash function: simply take the modul but prevent zero. Small values
|
||||
/* First hash function: simply take the modulus but prevent zero. Small values
|
||||
can skip the division, which helps performance when this is common. */
|
||||
size_t idx = 1 + (hval < htab->size ? hval : hval % htab->size);
|
||||
|
||||
@@ -77,7 +77,7 @@ lookup (NAME *htab, HASHTYPE hval)
|
||||
static int
|
||||
insert_helper (NAME *htab, HASHTYPE hval, TYPE val)
|
||||
{
|
||||
/* First hash function: simply take the modul but prevent zero. Small values
|
||||
/* First hash function: simply take the modulus but prevent zero. Small values
|
||||
can skip the division, which helps performance when this is common. */
|
||||
size_t idx = 1 + (hval < htab->size ? hval : hval % htab->size);
|
||||
|
||||
|
||||
@@ -33,13 +33,18 @@
|
||||
# include <pthread.h>
|
||||
# include <assert.h>
|
||||
# define rwlock_define(class,name) class pthread_rwlock_t name
|
||||
# define once_define(class,name) class pthread_once_t name = PTHREAD_ONCE_INIT
|
||||
# define RWLOCK_CALL(call) \
|
||||
({ int _err = pthread_rwlock_ ## call; assert_perror (_err); })
|
||||
# define ONCE_CALL(call) \
|
||||
({ int _err = pthread_ ## call; assert_perror (_err); })
|
||||
# define rwlock_init(lock) RWLOCK_CALL (init (&lock, NULL))
|
||||
# define rwlock_fini(lock) RWLOCK_CALL (destroy (&lock))
|
||||
# define rwlock_rdlock(lock) RWLOCK_CALL (rdlock (&lock))
|
||||
# define rwlock_wrlock(lock) RWLOCK_CALL (wrlock (&lock))
|
||||
# define rwlock_unlock(lock) RWLOCK_CALL (unlock (&lock))
|
||||
# define once(once_control, init_routine) \
|
||||
ONCE_CALL (once (&once_control, init_routine))
|
||||
#else
|
||||
/* Eventually we will allow multi-threaded applications to use the
|
||||
libraries. Therefore we will add the necessary locking although
|
||||
@@ -50,6 +55,8 @@
|
||||
# define rwlock_rdlock(lock) ((void) (lock))
|
||||
# define rwlock_wrlock(lock) ((void) (lock))
|
||||
# define rwlock_unlock(lock) ((void) (lock))
|
||||
# define once_define(class,name)
|
||||
# define once(once_control, init_routine) init_routine()
|
||||
#endif /* USE_LOCKS */
|
||||
|
||||
#include <libintl.h>
|
||||
|
||||
+1
-1
@@ -40,5 +40,5 @@ print_version (FILE *stream, struct argp_state *state)
|
||||
Copyright (C) %s The elfutils developers <%s>.\n\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
"), "2022", PACKAGE_URL);
|
||||
"), "2023", PACKAGE_URL);
|
||||
}
|
||||
|
||||
+11
-1
@@ -32,6 +32,9 @@
|
||||
#include <argp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Defined in version.c. Common ARGP_PROGRAM_VERSION_HOOK_DEF. */
|
||||
void print_version (FILE *stream, struct argp_state *state);
|
||||
|
||||
@@ -39,11 +42,18 @@ void print_version (FILE *stream, struct argp_state *state);
|
||||
argp_program_bug_address, in all programs. argp.h declares these
|
||||
variables as non-const (which is correct in general). But we can
|
||||
do better, it is not going to change. So we want to move them into
|
||||
the .rodata section. Define macros to do the trick. */
|
||||
the .rodata section. Define macros to do the trick. The default
|
||||
linkage for consts in C++ is internal, so declare them extern. */
|
||||
extern void (*const apvh) (FILE *, struct argp_state *);
|
||||
#define ARGP_PROGRAM_VERSION_HOOK_DEF \
|
||||
void (*const apvh) (FILE *, struct argp_state *) \
|
||||
__asm ("argp_program_version_hook")
|
||||
extern const char *const apba__;
|
||||
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
|
||||
const char *const apba__ __asm ("argp_program_bug_address")
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PRINTVERSION_H
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* System dependend headers */
|
||||
/* System dependent headers */
|
||||
#include <byteswap.h>
|
||||
#include <endian.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2023-02-17 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* asm_end.c (free_section): free scnp->content last.
|
||||
|
||||
2022-12-20 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* disasm_begin.c: Include libeblP.h.
|
||||
* disasm_cb.c: Likewise.
|
||||
* bpf_disasm.c: Likewise and include common.h.
|
||||
|
||||
2022-10-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* asm_abort.c: Don't include unistd.h.
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ libasm_so_LIBS = libasm_pic.a
|
||||
libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS)
|
||||
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
|
||||
-Wl,--soname,$@.$(VERSION) \
|
||||
-Wl,--version-script,$<,--no-undefined \
|
||||
-Wl,--version-script,$< \
|
||||
$(NO_UNDEFINED) \
|
||||
-Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \
|
||||
$(libasm_so_LDLIBS)
|
||||
@$(textrel_check)
|
||||
|
||||
+10
-8
@@ -541,16 +541,18 @@ free_section (AsmScn_t *scnp)
|
||||
if (scnp->subnext != NULL)
|
||||
free_section (scnp->subnext);
|
||||
|
||||
/* This is a circular single linked list. */
|
||||
struct AsmData *data = scnp->content;
|
||||
if (data != NULL)
|
||||
do
|
||||
{
|
||||
oldp = data;
|
||||
data = data->next;
|
||||
free (oldp);
|
||||
}
|
||||
while (oldp != scnp->content);
|
||||
|
||||
{
|
||||
while (data != scnp->content)
|
||||
{
|
||||
oldp = data;
|
||||
data = data->next;
|
||||
free (oldp);
|
||||
}
|
||||
free (scnp->content);
|
||||
}
|
||||
free (scnp);
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -41,19 +41,25 @@
|
||||
|
||||
|
||||
/* Memory for the default pattern. The type uses a flexible array
|
||||
which does work well with a static initializer. So we play some
|
||||
dirty tricks here. */
|
||||
static const struct
|
||||
which does work well with a static initializer. Work around this by
|
||||
wrapping it in a union, whose second member is a char array 1 byte larger
|
||||
than struct FillPattern. According to 6.7.9, this does what we need:
|
||||
|
||||
If an object that has static or thread storage duration is not
|
||||
initialized explicitly, then ... if it is a union, the first named
|
||||
member is initialized (recursively) according to these rules, and
|
||||
any padding is initialized to zero bits. */
|
||||
|
||||
static const union
|
||||
{
|
||||
struct FillPattern pattern;
|
||||
char zero;
|
||||
char zeroes[sizeof(struct FillPattern) + 1];
|
||||
} xdefault_pattern =
|
||||
{
|
||||
.pattern =
|
||||
{
|
||||
.len = 1
|
||||
},
|
||||
.zero = '\0'
|
||||
};
|
||||
const struct FillPattern *__libasm_default_pattern = &xdefault_pattern.pattern;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libasmP.h"
|
||||
#include "../libebl/libeblP.h"
|
||||
#include "libeblP.h"
|
||||
|
||||
|
||||
DisasmCtx_t *
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "libasmP.h"
|
||||
#include "../libebl/libeblP.h"
|
||||
#include "libeblP.h"
|
||||
|
||||
|
||||
struct symtoken
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
2022-12-18 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* i386_mne.h: New file, extracted from i386_disasm.c.
|
||||
* Makefile.am (noinst_HEADERS): Add i386_mne.h.
|
||||
(i386_parse_CFLAGS): Removed.
|
||||
* i386_disasm.c: Include i386_mne.h.
|
||||
* i386_parse.y: Include i386_mne.h.
|
||||
(instrtable_out): Use MNE_COUNT instead of NMNES.
|
||||
|
||||
2022-12-18 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* i386_disasm.c (i386_disasm): Use __asm instead of asm.
|
||||
|
||||
2022-12-20 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* bpf_disasm.c: Include common.h and libeblP.h.
|
||||
* i386_disasm.c: Include libeblP.h.
|
||||
* riscv_disasm.c: Likewise.
|
||||
|
||||
2022-10-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* i386_data.h: Define FCT_mod$64r_m as FCT_mod$r_m for i386.
|
||||
|
||||
2022-10-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* i386_disasm.c: Don't include endian.h.
|
||||
|
||||
+1
-2
@@ -40,7 +40,7 @@ AM_YFLAGS = -p$(<F:parse.y=)
|
||||
|
||||
noinst_LIBRARIES = libcpu.a libcpu_pic.a
|
||||
|
||||
noinst_HEADERS = i386_dis.h x86_64_dis.h
|
||||
noinst_HEADERS = i386_dis.h i386_mne.h x86_64_dis.h
|
||||
|
||||
libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
|
||||
|
||||
@@ -92,7 +92,6 @@ libeu = ../lib/libeu.a
|
||||
i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
|
||||
-Wno-implicit-fallthrough
|
||||
i386_parse.o: i386_parse.c i386.mnemonics
|
||||
i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
|
||||
i386_lex.o: i386_parse.h
|
||||
i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
|
||||
|
||||
|
||||
+2
-2
@@ -37,8 +37,8 @@
|
||||
#include <inttypes.h>
|
||||
#include "bpf.h"
|
||||
|
||||
#include "../libelf/common.h"
|
||||
#include "../libebl/libeblP.h"
|
||||
#include "common.h"
|
||||
#include "libeblP.h"
|
||||
|
||||
static const char class_string[8][8] = {
|
||||
[BPF_LD] = "ld",
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
{imm} only parameter:
|
||||
- is {s} in opcode: {s} == 0, unsigned (8/)16/32 bit immediate
|
||||
{s} == 1, signed 8 bit immediate
|
||||
|
||||
{es:di}: segment register normally %es, can be overwritten
|
||||
edi/di depending on apfx
|
||||
|
||||
{ds:si}: segment register normally %ds, can be overwritten
|
||||
esi/si depending on apfx
|
||||
|
||||
{ax} al/ax/eax depending of dpfx and w
|
||||
|
||||
{dx} (%edx) or (%dx) depending on apfx
|
||||
|
||||
|
||||
{w} 0 = b, 1 = { no dpfx = l, dpfx = w }
|
||||
|
||||
{W} no dpfx = <empty>, dpfx = w
|
||||
{WW} no dpfx = l, dpfx = w
|
||||
|
||||
{R} rep prefix possible
|
||||
{RE} repe or repne prefix possible
|
||||
|
||||
{ccc} CRx registers
|
||||
{ddd} DRx registers
|
||||
|
||||
{gg} 00 = b, 01 = w, 10 = d, 11 = <illegal>
|
||||
{0g} 00 = b, 01 = w, 10 = <illegal>, 11 = <illegal>
|
||||
{GG} 00 = <illegal>, 01 = w, 10 = d, 11 = q
|
||||
{gG} 00 = <illegal>, 01 = w, 10 = d, 11 = <illegal>
|
||||
|
||||
{modr/m} normal registers
|
||||
{MODR/M} MMX registers
|
||||
{ModR/m} XMM registers
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Special opcodes (prefixes):
|
||||
|
||||
|
||||
01100111:{apfx}
|
||||
01100110:{dpfx}
|
||||
|
||||
00101110:{cs}
|
||||
00111110:{ds}
|
||||
00100110:{es}
|
||||
01100100:{fs}
|
||||
01100101:{gs}
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
table format
|
||||
|
||||
1bit RE flag
|
||||
1bit R flag
|
||||
16bit mnemonic
|
||||
3bit suffix
|
||||
|
||||
5bit fct
|
||||
2bit string
|
||||
6bit offset1
|
||||
5bit offset2
|
||||
|
||||
4bit fct
|
||||
1bit string
|
||||
6bit offset1
|
||||
4bit offset2
|
||||
|
||||
2bit fct
|
||||
1bit string
|
||||
3bit offset1
|
||||
1bit offset2
|
||||
|
||||
61bit
|
||||
@@ -1,515 +0,0 @@
|
||||
MNE(aaa)
|
||||
MNE(aad)
|
||||
MNE(aam)
|
||||
MNE(aas)
|
||||
MNE(adc)
|
||||
MNE(add)
|
||||
MNE(addpd)
|
||||
MNE(addps)
|
||||
MNE(addsd)
|
||||
MNE(addss)
|
||||
MNE(addsubpd)
|
||||
MNE(addsubps)
|
||||
MNE(and)
|
||||
MNE(andnpd)
|
||||
MNE(andnps)
|
||||
MNE(andpd)
|
||||
MNE(andps)
|
||||
MNE(arpl)
|
||||
MNE(blendpd)
|
||||
MNE(blendps)
|
||||
MNE(blendvpd)
|
||||
MNE(blendvps)
|
||||
MNE(bound)
|
||||
MNE(bsf)
|
||||
MNE(bsr)
|
||||
MNE(bswap)
|
||||
MNE(bt)
|
||||
MNE(btc)
|
||||
MNE(btr)
|
||||
MNE(bts)
|
||||
MNE(call)
|
||||
MNE(clc)
|
||||
MNE(cld)
|
||||
MNE(clflush)
|
||||
MNE(cli)
|
||||
MNE(clts)
|
||||
MNE(cmc)
|
||||
MNE(cmov)
|
||||
MNE(cmp)
|
||||
MNE(cmpeqps)
|
||||
MNE(cmpeqss)
|
||||
MNE(cmpleps)
|
||||
MNE(cmpless)
|
||||
MNE(cmpltps)
|
||||
MNE(cmpltss)
|
||||
MNE(cmpneqps)
|
||||
MNE(cmpneqss)
|
||||
MNE(cmpnleps)
|
||||
MNE(cmpnless)
|
||||
MNE(cmpnltps)
|
||||
MNE(cmpnltss)
|
||||
MNE(cmpordps)
|
||||
MNE(cmpordss)
|
||||
MNE(cmps)
|
||||
MNE(cmpunordps)
|
||||
MNE(cmpunordss)
|
||||
MNE(cmpxchg)
|
||||
MNE(cmpxchg8b)
|
||||
MNE(comisd)
|
||||
MNE(comiss)
|
||||
MNE(cpuid)
|
||||
MNE(cvtdq2pd)
|
||||
MNE(cvtdq2ps)
|
||||
MNE(cvtpd2dq)
|
||||
MNE(cvtpd2pi)
|
||||
MNE(cvtpd2ps)
|
||||
MNE(cvtpi2pd)
|
||||
MNE(cvtpi2ps)
|
||||
MNE(cvtps2dq)
|
||||
MNE(cvtps2pd)
|
||||
MNE(cvtps2pi)
|
||||
MNE(cvtsd2si)
|
||||
MNE(cvtsd2ss)
|
||||
MNE(cvtsi2sd)
|
||||
MNE(cvtsi2ss)
|
||||
MNE(cvtss2sd)
|
||||
MNE(cvtss2si)
|
||||
MNE(cvttpd2dq)
|
||||
MNE(cvttpd2pi)
|
||||
MNE(cvttps2dq)
|
||||
MNE(cvttps2pi)
|
||||
MNE(cvttsd2si)
|
||||
MNE(cvttss2si)
|
||||
MNE(daa)
|
||||
MNE(das)
|
||||
MNE(dec)
|
||||
MNE(div)
|
||||
MNE(divpd)
|
||||
MNE(divps)
|
||||
MNE(divsd)
|
||||
MNE(divss)
|
||||
MNE(dppd)
|
||||
MNE(dpps)
|
||||
MNE(emms)
|
||||
MNE(enter)
|
||||
MNE(f2xm1)
|
||||
MNE(fabs)
|
||||
MNE(fadd)
|
||||
MNE(faddp)
|
||||
MNE(fbld)
|
||||
MNE(fbstp)
|
||||
MNE(fchs)
|
||||
MNE(fclex)
|
||||
MNE(fcmovb)
|
||||
MNE(fcmovbe)
|
||||
MNE(fcmove)
|
||||
MNE(fcmovnb)
|
||||
MNE(fcmovnbe)
|
||||
MNE(fcmovne)
|
||||
MNE(fcmovnu)
|
||||
MNE(fcmovu)
|
||||
MNE(fcom)
|
||||
MNE(fcomi)
|
||||
MNE(fcomip)
|
||||
MNE(fcomp)
|
||||
MNE(fcompp)
|
||||
MNE(fcos)
|
||||
MNE(fdecstp)
|
||||
MNE(fdiv)
|
||||
MNE(fdivp)
|
||||
MNE(fdivr)
|
||||
MNE(fdivrp)
|
||||
MNE(ffree)
|
||||
MNE(fiadd)
|
||||
MNE(ficom)
|
||||
MNE(ficomp)
|
||||
MNE(fidiv)
|
||||
MNE(fidivl)
|
||||
MNE(fidivr)
|
||||
MNE(fidivrl)
|
||||
MNE(fild)
|
||||
MNE(fildl)
|
||||
MNE(fildll)
|
||||
MNE(fimul)
|
||||
MNE(fincstp)
|
||||
MNE(finit)
|
||||
MNE(fist)
|
||||
MNE(fistp)
|
||||
MNE(fistpll)
|
||||
MNE(fisttp)
|
||||
MNE(fisttpll)
|
||||
MNE(fisub)
|
||||
MNE(fisubr)
|
||||
MNE(fld)
|
||||
MNE(fld1)
|
||||
MNE(fldcw)
|
||||
MNE(fldenv)
|
||||
MNE(fldl2e)
|
||||
MNE(fldl2t)
|
||||
MNE(fldlg2)
|
||||
MNE(fldln2)
|
||||
MNE(fldpi)
|
||||
MNE(fldt)
|
||||
MNE(fldz)
|
||||
MNE(fmul)
|
||||
MNE(fmulp)
|
||||
MNE(fnclex)
|
||||
MNE(fninit)
|
||||
MNE(fnop)
|
||||
MNE(fnsave)
|
||||
MNE(fnstcw)
|
||||
MNE(fnstenv)
|
||||
MNE(fnstsw)
|
||||
MNE(fpatan)
|
||||
MNE(fprem)
|
||||
MNE(fprem1)
|
||||
MNE(fptan)
|
||||
MNE(frndint)
|
||||
MNE(frstor)
|
||||
MNE(fscale)
|
||||
MNE(fsin)
|
||||
MNE(fsincos)
|
||||
MNE(fsqrt)
|
||||
MNE(fst)
|
||||
MNE(fstp)
|
||||
MNE(fstpt)
|
||||
MNE(fsub)
|
||||
MNE(fsubp)
|
||||
MNE(fsubr)
|
||||
MNE(fsubrp)
|
||||
MNE(ftst)
|
||||
MNE(fucom)
|
||||
MNE(fucomi)
|
||||
MNE(fucomip)
|
||||
MNE(fucomp)
|
||||
MNE(fwait)
|
||||
MNE(fxam)
|
||||
MNE(fxch)
|
||||
MNE(fxrstor)
|
||||
MNE(fxsave)
|
||||
MNE(fxtract)
|
||||
MNE(fyl2x)
|
||||
MNE(fyl2xp1)
|
||||
MNE(getsec)
|
||||
MNE(haddpd)
|
||||
MNE(haddps)
|
||||
MNE(hlt)
|
||||
MNE(hsubpd)
|
||||
MNE(hsubps)
|
||||
MNE(idiv)
|
||||
MNE(imul)
|
||||
MNE(in)
|
||||
MNE(inc)
|
||||
MNE(ins)
|
||||
MNE(insertps)
|
||||
MNE(int)
|
||||
MNE(int3)
|
||||
MNE(into)
|
||||
MNE(invd)
|
||||
MNE(invlpg)
|
||||
MNE(iret)
|
||||
MNE(j)
|
||||
MNE(jmp)
|
||||
MNE(lahf)
|
||||
MNE(lar)
|
||||
MNE(lcall)
|
||||
MNE(lddqu)
|
||||
MNE(ldmxcsr)
|
||||
MNE(lds)
|
||||
MNE(lea)
|
||||
MNE(leave)
|
||||
MNE(les)
|
||||
MNE(lfence)
|
||||
MNE(lfs)
|
||||
MNE(lgdt)
|
||||
MNE(lgs)
|
||||
MNE(lidt)
|
||||
MNE(ljmp)
|
||||
MNE(lldt)
|
||||
MNE(lmsw)
|
||||
MNE(lock)
|
||||
MNE(lods)
|
||||
MNE(loop)
|
||||
MNE(loope)
|
||||
MNE(loopne)
|
||||
MNE(lret)
|
||||
MNE(lsl)
|
||||
MNE(lss)
|
||||
MNE(ltr)
|
||||
MNE(maskmovdqu)
|
||||
MNE(maskmovq)
|
||||
MNE(maxpd)
|
||||
MNE(maxps)
|
||||
MNE(maxsd)
|
||||
MNE(maxss)
|
||||
MNE(mfence)
|
||||
MNE(minpd)
|
||||
MNE(minps)
|
||||
MNE(minsd)
|
||||
MNE(minss)
|
||||
MNE(monitor)
|
||||
MNE(mov)
|
||||
MNE(movapd)
|
||||
MNE(movaps)
|
||||
MNE(movd)
|
||||
MNE(movddup)
|
||||
MNE(movdq2q)
|
||||
MNE(movdqa)
|
||||
MNE(movdqu)
|
||||
MNE(movhlpd)
|
||||
MNE(movhlps)
|
||||
MNE(movhpd)
|
||||
MNE(movhps)
|
||||
MNE(movlhpd)
|
||||
MNE(movlhps)
|
||||
MNE(movlpd)
|
||||
MNE(movlps)
|
||||
MNE(movmskpd)
|
||||
MNE(movmskps)
|
||||
MNE(movntdq)
|
||||
MNE(movntdqa)
|
||||
MNE(movnti)
|
||||
MNE(movntpd)
|
||||
MNE(movntps)
|
||||
MNE(movntq)
|
||||
MNE(movq)
|
||||
MNE(movq2dq)
|
||||
MNE(movs)
|
||||
MNE(movsbl)
|
||||
MNE(movsd)
|
||||
MNE(movshdup)
|
||||
MNE(movsldup)
|
||||
MNE(movss)
|
||||
MNE(movswl)
|
||||
MNE(movupd)
|
||||
MNE(movups)
|
||||
MNE(movzbl)
|
||||
MNE(movzwl)
|
||||
MNE(mpsadbw)
|
||||
MNE(mul)
|
||||
MNE(mulpd)
|
||||
MNE(mulps)
|
||||
MNE(mulsd)
|
||||
MNE(mulss)
|
||||
MNE(mwait)
|
||||
MNE(neg)
|
||||
MNE(nop)
|
||||
MNE(not)
|
||||
MNE(or)
|
||||
MNE(orpd)
|
||||
MNE(orps)
|
||||
MNE(out)
|
||||
MNE(outs)
|
||||
MNE(pabsb)
|
||||
MNE(pabsd)
|
||||
MNE(pabsw)
|
||||
MNE(packssdw)
|
||||
MNE(packsswb)
|
||||
MNE(packusdw)
|
||||
MNE(packuswb)
|
||||
MNE(paddb)
|
||||
MNE(paddd)
|
||||
MNE(paddq)
|
||||
MNE(paddsb)
|
||||
MNE(paddsw)
|
||||
MNE(paddusb)
|
||||
MNE(paddusw)
|
||||
MNE(paddw)
|
||||
MNE(palignr)
|
||||
MNE(pand)
|
||||
MNE(pandn)
|
||||
MNE(pause)
|
||||
MNE(pavgb)
|
||||
MNE(pavgw)
|
||||
MNE(pblendvb)
|
||||
MNE(pblendw)
|
||||
MNE(pcmpeqb)
|
||||
MNE(pcmpeqd)
|
||||
MNE(pcmpeqq)
|
||||
MNE(pcmpeqw)
|
||||
MNE(pcmpestri)
|
||||
MNE(pcmpestrm)
|
||||
MNE(pcmpgtb)
|
||||
MNE(pcmpgtd)
|
||||
MNE(pcmpgtq)
|
||||
MNE(pcmpgtw)
|
||||
MNE(pcmpistri)
|
||||
MNE(pcmpistrm)
|
||||
MNE(pextrw)
|
||||
MNE(phaddd)
|
||||
MNE(phaddsw)
|
||||
MNE(phaddw)
|
||||
MNE(phminposuw)
|
||||
MNE(phsubd)
|
||||
MNE(phsubsw)
|
||||
MNE(phsubw)
|
||||
MNE(pinsrb)
|
||||
MNE(pinsrd)
|
||||
MNE(pinsrw)
|
||||
MNE(pmaddubsw)
|
||||
MNE(pmaddwd)
|
||||
MNE(pmaxsb)
|
||||
MNE(pmaxsd)
|
||||
MNE(pmaxsw)
|
||||
MNE(pmaxub)
|
||||
MNE(pmaxud)
|
||||
MNE(pmaxuw)
|
||||
MNE(pminsb)
|
||||
MNE(pminsd)
|
||||
MNE(pminsw)
|
||||
MNE(pminub)
|
||||
MNE(pminud)
|
||||
MNE(pminuw)
|
||||
MNE(pmovmskb)
|
||||
MNE(pmovsxbd)
|
||||
MNE(pmovsxbq)
|
||||
MNE(pmovsxbw)
|
||||
MNE(pmovsxdq)
|
||||
MNE(pmovsxwd)
|
||||
MNE(pmovsxwq)
|
||||
MNE(pmovzxbd)
|
||||
MNE(pmovzxbq)
|
||||
MNE(pmovzxbw)
|
||||
MNE(pmovzxdq)
|
||||
MNE(pmovzxwd)
|
||||
MNE(pmovzxwq)
|
||||
MNE(pmuldq)
|
||||
MNE(pmulhrsw)
|
||||
MNE(pmulhuw)
|
||||
MNE(pmulhw)
|
||||
MNE(pmulld)
|
||||
MNE(pmullw)
|
||||
MNE(pmuludq)
|
||||
MNE(pop)
|
||||
MNE(popa)
|
||||
MNE(popcnt)
|
||||
MNE(popf)
|
||||
MNE(por)
|
||||
MNE(prefetch)
|
||||
MNE(prefetchnta)
|
||||
MNE(prefetcht0)
|
||||
MNE(prefetcht1)
|
||||
MNE(prefetcht2)
|
||||
MNE(prefetchw)
|
||||
MNE(psadbw)
|
||||
MNE(pshufb)
|
||||
MNE(pshufd)
|
||||
MNE(pshufhw)
|
||||
MNE(pshuflw)
|
||||
MNE(pshufw)
|
||||
MNE(psignb)
|
||||
MNE(psignd)
|
||||
MNE(psignw)
|
||||
MNE(pslld)
|
||||
MNE(pslldq)
|
||||
MNE(psllq)
|
||||
MNE(psllw)
|
||||
MNE(psrad)
|
||||
MNE(psraw)
|
||||
MNE(psrld)
|
||||
MNE(psrldq)
|
||||
MNE(psrlq)
|
||||
MNE(psrlw)
|
||||
MNE(psubb)
|
||||
MNE(psubd)
|
||||
MNE(psubq)
|
||||
MNE(psubsb)
|
||||
MNE(psubsw)
|
||||
MNE(psubusb)
|
||||
MNE(psubusw)
|
||||
MNE(psubw)
|
||||
MNE(ptest)
|
||||
MNE(punpckhbw)
|
||||
MNE(punpckhdq)
|
||||
MNE(punpckhqdq)
|
||||
MNE(punpckhwd)
|
||||
MNE(punpcklbw)
|
||||
MNE(punpckldq)
|
||||
MNE(punpcklqdq)
|
||||
MNE(punpcklwd)
|
||||
MNE(push)
|
||||
MNE(pusha)
|
||||
MNE(pushf)
|
||||
MNE(pxor)
|
||||
MNE(rcl)
|
||||
MNE(rcpps)
|
||||
MNE(rcpss)
|
||||
MNE(rcr)
|
||||
MNE(rdmsr)
|
||||
MNE(rdpmc)
|
||||
MNE(rdtsc)
|
||||
MNE(ret)
|
||||
MNE(rol)
|
||||
MNE(ror)
|
||||
MNE(roundpd)
|
||||
MNE(roundps)
|
||||
MNE(roundsd)
|
||||
MNE(roundss)
|
||||
MNE(rsm)
|
||||
MNE(rsqrtps)
|
||||
MNE(rsqrtss)
|
||||
MNE(sahf)
|
||||
MNE(sar)
|
||||
MNE(sbb)
|
||||
MNE(scas)
|
||||
MNE(set)
|
||||
MNE(sfence)
|
||||
MNE(sgdtl)
|
||||
MNE(shl)
|
||||
MNE(shld)
|
||||
MNE(shr)
|
||||
MNE(shrd)
|
||||
MNE(shufpd)
|
||||
MNE(shufps)
|
||||
MNE(sidtl)
|
||||
MNE(sldt)
|
||||
MNE(smsw)
|
||||
MNE(sqrtpd)
|
||||
MNE(sqrtps)
|
||||
MNE(sqrtsd)
|
||||
MNE(sqrtss)
|
||||
MNE(stc)
|
||||
MNE(std)
|
||||
MNE(sti)
|
||||
MNE(stmxcsr)
|
||||
MNE(stos)
|
||||
MNE(str)
|
||||
MNE(sub)
|
||||
MNE(subpd)
|
||||
MNE(subps)
|
||||
MNE(subsd)
|
||||
MNE(subss)
|
||||
MNE(swapgs)
|
||||
MNE(syscall)
|
||||
MNE(sysenter)
|
||||
MNE(sysexit)
|
||||
MNE(sysret)
|
||||
MNE(test)
|
||||
MNE(ucomisd)
|
||||
MNE(ucomiss)
|
||||
MNE(ud2a)
|
||||
MNE(unpckhpd)
|
||||
MNE(unpckhps)
|
||||
MNE(unpcklpd)
|
||||
MNE(unpcklps)
|
||||
MNE(verr)
|
||||
MNE(verw)
|
||||
MNE(vmcall)
|
||||
MNE(vmclear)
|
||||
MNE(vmlaunch)
|
||||
MNE(vmptrld)
|
||||
MNE(vmptrst)
|
||||
MNE(vmread)
|
||||
MNE(vmresume)
|
||||
MNE(vmwrite)
|
||||
MNE(vmxoff)
|
||||
MNE(vmxon)
|
||||
MNE(wbinvd)
|
||||
MNE(wrmsr)
|
||||
MNE(xadd)
|
||||
MNE(xchg)
|
||||
MNE(xlat)
|
||||
MNE(xor)
|
||||
MNE(xorpd)
|
||||
MNE(xorps)
|
||||
+1
-1
@@ -1153,7 +1153,7 @@ FCT_mod$64r_m (struct output_data *d)
|
||||
return general_mod$r_m (d);
|
||||
}
|
||||
#else
|
||||
static typeof (FCT_mod$r_m) FCT_mod$64r_m __attribute__ ((alias ("FCT_mod$r_m")));
|
||||
#define FCT_mod$64r_m FCT_mod$r_m
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
-1657
File diff suppressed because it is too large
Load Diff
+4
-16
@@ -41,15 +41,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../libebl/libeblP.h"
|
||||
#include "libeblP.h"
|
||||
|
||||
#define MACHINE_ENCODING LITTLE_ENDIAN
|
||||
#include "memory-access.h"
|
||||
|
||||
|
||||
#ifndef MNEFILE
|
||||
# define MNEFILE "i386.mnemonics"
|
||||
#endif
|
||||
#include "i386_mne.h"
|
||||
|
||||
#define MNESTRFIELD(line) MNESTRFIELD1 (line)
|
||||
#define MNESTRFIELD1(line) str##line
|
||||
@@ -71,15 +68,6 @@ static const union mnestr_t
|
||||
}
|
||||
};
|
||||
|
||||
/* The index can be stored in the instrtab. */
|
||||
enum
|
||||
{
|
||||
#define MNE(name) MNE_##name,
|
||||
#include MNEFILE
|
||||
#undef MNE
|
||||
MNE_INVALID
|
||||
};
|
||||
|
||||
static const unsigned short int mneidx[] =
|
||||
{
|
||||
#define MNE(name) \
|
||||
@@ -480,8 +468,8 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
|
||||
|
||||
/* gcc is not clever enough to see the following variables
|
||||
are not used uninitialized. */
|
||||
asm (""
|
||||
: "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
|
||||
__asm (""
|
||||
: "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
|
||||
"=mr" (next_curr), "=mr" (len));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Disassembler for x86, MNE enums.
|
||||
Copyright (C) 2007, 2008, 2009, 2011 Red Hat, 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/>. */
|
||||
|
||||
#ifndef _I386_MNE_H
|
||||
#define _I386_MNE_H 1
|
||||
|
||||
#ifndef MNEFILE
|
||||
# define MNEFILE "i386.mnemonics"
|
||||
#endif
|
||||
|
||||
/* The index can be stored in the instrtab. */
|
||||
enum
|
||||
{
|
||||
#define MNE(name) MNE_##name,
|
||||
#include MNEFILE
|
||||
#undef MNE
|
||||
MNE_INVALID,
|
||||
MNE_COUNT = MNE_INVALID,
|
||||
};
|
||||
|
||||
#endif /* i386_mne.h */
|
||||
+3
-6
@@ -46,6 +46,8 @@
|
||||
#include <libeu.h>
|
||||
#include <system.h>
|
||||
|
||||
#include "i386_mne.h"
|
||||
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
@@ -1107,11 +1109,6 @@ print_op_fct (const void *nodep, VISIT value,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if NMNES < 2
|
||||
# error "bogus NMNES value"
|
||||
#endif
|
||||
|
||||
static void
|
||||
instrtable_out (void)
|
||||
{
|
||||
@@ -1123,7 +1120,7 @@ instrtable_out (void)
|
||||
fprintf (outfile, "#define MNEMONIC_BITS %zu\n", best_mnemonic_bits);
|
||||
#else
|
||||
fprintf (outfile, "#define MNEMONIC_BITS %ld\n",
|
||||
lrint (ceil (log2 (NMNES))));
|
||||
lrint (ceil (log2 (MNE_COUNT))));
|
||||
#endif
|
||||
fprintf (outfile, "#define SUFFIX_BITS %d\n", nbitsuf);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../libebl/libeblP.h"
|
||||
#include "libeblP.h"
|
||||
|
||||
#define MACHINE_ENCODING LITTLE_ENDIAN
|
||||
#include "memory-access.h"
|
||||
|
||||
@@ -1,503 +0,0 @@
|
||||
MNE(adc)
|
||||
MNE(add)
|
||||
MNE(addpd)
|
||||
MNE(addps)
|
||||
MNE(addsd)
|
||||
MNE(addss)
|
||||
MNE(addsubpd)
|
||||
MNE(addsubps)
|
||||
MNE(and)
|
||||
MNE(andnpd)
|
||||
MNE(andnps)
|
||||
MNE(andpd)
|
||||
MNE(andps)
|
||||
MNE(blendpd)
|
||||
MNE(blendps)
|
||||
MNE(blendvpd)
|
||||
MNE(blendvps)
|
||||
MNE(bsf)
|
||||
MNE(bsr)
|
||||
MNE(bswap)
|
||||
MNE(bt)
|
||||
MNE(btc)
|
||||
MNE(btr)
|
||||
MNE(bts)
|
||||
MNE(call)
|
||||
MNE(clc)
|
||||
MNE(cld)
|
||||
MNE(clflush)
|
||||
MNE(cli)
|
||||
MNE(clts)
|
||||
MNE(cmc)
|
||||
MNE(cmov)
|
||||
MNE(cmp)
|
||||
MNE(cmpeqps)
|
||||
MNE(cmpeqss)
|
||||
MNE(cmpleps)
|
||||
MNE(cmpless)
|
||||
MNE(cmpltps)
|
||||
MNE(cmpltss)
|
||||
MNE(cmpneqps)
|
||||
MNE(cmpneqss)
|
||||
MNE(cmpnleps)
|
||||
MNE(cmpnless)
|
||||
MNE(cmpnltps)
|
||||
MNE(cmpnltss)
|
||||
MNE(cmpordps)
|
||||
MNE(cmpordss)
|
||||
MNE(cmps)
|
||||
MNE(cmpunordps)
|
||||
MNE(cmpunordss)
|
||||
MNE(cmpxchg)
|
||||
MNE(comisd)
|
||||
MNE(comiss)
|
||||
MNE(cpuid)
|
||||
MNE(cvtdq2pd)
|
||||
MNE(cvtdq2ps)
|
||||
MNE(cvtpd2dq)
|
||||
MNE(cvtpd2pi)
|
||||
MNE(cvtpd2ps)
|
||||
MNE(cvtpi2pd)
|
||||
MNE(cvtpi2ps)
|
||||
MNE(cvtps2dq)
|
||||
MNE(cvtps2pd)
|
||||
MNE(cvtps2pi)
|
||||
MNE(cvtsd2si)
|
||||
MNE(cvtsd2ss)
|
||||
MNE(cvtsi2sd)
|
||||
MNE(cvtsi2ss)
|
||||
MNE(cvtss2sd)
|
||||
MNE(cvtss2si)
|
||||
MNE(cvttpd2dq)
|
||||
MNE(cvttpd2pi)
|
||||
MNE(cvttps2dq)
|
||||
MNE(cvttps2pi)
|
||||
MNE(cvttsd2si)
|
||||
MNE(cvttss2si)
|
||||
MNE(dec)
|
||||
MNE(div)
|
||||
MNE(divpd)
|
||||
MNE(divps)
|
||||
MNE(divsd)
|
||||
MNE(divss)
|
||||
MNE(dppd)
|
||||
MNE(dpps)
|
||||
MNE(emms)
|
||||
MNE(enter)
|
||||
MNE(f2xm1)
|
||||
MNE(fabs)
|
||||
MNE(fadd)
|
||||
MNE(faddp)
|
||||
MNE(fbld)
|
||||
MNE(fbstp)
|
||||
MNE(fchs)
|
||||
MNE(fclex)
|
||||
MNE(fcmovb)
|
||||
MNE(fcmovbe)
|
||||
MNE(fcmove)
|
||||
MNE(fcmovnb)
|
||||
MNE(fcmovnbe)
|
||||
MNE(fcmovne)
|
||||
MNE(fcmovnu)
|
||||
MNE(fcmovu)
|
||||
MNE(fcom)
|
||||
MNE(fcomi)
|
||||
MNE(fcomip)
|
||||
MNE(fcomp)
|
||||
MNE(fcompp)
|
||||
MNE(fcos)
|
||||
MNE(fdecstp)
|
||||
MNE(fdiv)
|
||||
MNE(fdivp)
|
||||
MNE(fdivr)
|
||||
MNE(fdivrp)
|
||||
MNE(ffree)
|
||||
MNE(fiadd)
|
||||
MNE(ficom)
|
||||
MNE(ficomp)
|
||||
MNE(fidiv)
|
||||
MNE(fidivl)
|
||||
MNE(fidivr)
|
||||
MNE(fidivrl)
|
||||
MNE(fild)
|
||||
MNE(fildl)
|
||||
MNE(fildll)
|
||||
MNE(fimul)
|
||||
MNE(fincstp)
|
||||
MNE(finit)
|
||||
MNE(fist)
|
||||
MNE(fistp)
|
||||
MNE(fistpll)
|
||||
MNE(fisttp)
|
||||
MNE(fisttpll)
|
||||
MNE(fisub)
|
||||
MNE(fisubr)
|
||||
MNE(fld)
|
||||
MNE(fld1)
|
||||
MNE(fldcw)
|
||||
MNE(fldenv)
|
||||
MNE(fldl2e)
|
||||
MNE(fldl2t)
|
||||
MNE(fldlg2)
|
||||
MNE(fldln2)
|
||||
MNE(fldpi)
|
||||
MNE(fldt)
|
||||
MNE(fldz)
|
||||
MNE(fmul)
|
||||
MNE(fmulp)
|
||||
MNE(fnclex)
|
||||
MNE(fninit)
|
||||
MNE(fnop)
|
||||
MNE(fnsave)
|
||||
MNE(fnstcw)
|
||||
MNE(fnstenv)
|
||||
MNE(fnstsw)
|
||||
MNE(fpatan)
|
||||
MNE(fprem)
|
||||
MNE(fprem1)
|
||||
MNE(fptan)
|
||||
MNE(frndint)
|
||||
MNE(frstor)
|
||||
MNE(fscale)
|
||||
MNE(fsin)
|
||||
MNE(fsincos)
|
||||
MNE(fsqrt)
|
||||
MNE(fst)
|
||||
MNE(fstp)
|
||||
MNE(fstpt)
|
||||
MNE(fsub)
|
||||
MNE(fsubp)
|
||||
MNE(fsubr)
|
||||
MNE(fsubrp)
|
||||
MNE(ftst)
|
||||
MNE(fucom)
|
||||
MNE(fucomi)
|
||||
MNE(fucomip)
|
||||
MNE(fucomp)
|
||||
MNE(fwait)
|
||||
MNE(fxam)
|
||||
MNE(fxch)
|
||||
MNE(fxrstor)
|
||||
MNE(fxsave)
|
||||
MNE(fxtract)
|
||||
MNE(fyl2x)
|
||||
MNE(fyl2xp1)
|
||||
MNE(getsec)
|
||||
MNE(haddpd)
|
||||
MNE(haddps)
|
||||
MNE(hlt)
|
||||
MNE(hsubpd)
|
||||
MNE(hsubps)
|
||||
MNE(idiv)
|
||||
MNE(imul)
|
||||
MNE(in)
|
||||
MNE(inc)
|
||||
MNE(ins)
|
||||
MNE(insertps)
|
||||
MNE(int)
|
||||
MNE(int3)
|
||||
MNE(invd)
|
||||
MNE(invlpg)
|
||||
MNE(iret)
|
||||
MNE(j)
|
||||
MNE(jmp)
|
||||
MNE(lahf)
|
||||
MNE(lar)
|
||||
MNE(lcall)
|
||||
MNE(lddqu)
|
||||
MNE(ldmxcsr)
|
||||
MNE(lea)
|
||||
MNE(leave)
|
||||
MNE(lfence)
|
||||
MNE(lfs)
|
||||
MNE(lgdt)
|
||||
MNE(lgs)
|
||||
MNE(lidt)
|
||||
MNE(ljmp)
|
||||
MNE(lldt)
|
||||
MNE(lmsw)
|
||||
MNE(lock)
|
||||
MNE(lods)
|
||||
MNE(loop)
|
||||
MNE(loope)
|
||||
MNE(loopne)
|
||||
MNE(lret)
|
||||
MNE(lsl)
|
||||
MNE(lss)
|
||||
MNE(ltr)
|
||||
MNE(maskmovdqu)
|
||||
MNE(maskmovq)
|
||||
MNE(maxpd)
|
||||
MNE(maxps)
|
||||
MNE(maxsd)
|
||||
MNE(maxss)
|
||||
MNE(mfence)
|
||||
MNE(minpd)
|
||||
MNE(minps)
|
||||
MNE(minsd)
|
||||
MNE(minss)
|
||||
MNE(monitor)
|
||||
MNE(mov)
|
||||
MNE(movapd)
|
||||
MNE(movaps)
|
||||
MNE(movd)
|
||||
MNE(movddup)
|
||||
MNE(movdq2q)
|
||||
MNE(movdqa)
|
||||
MNE(movdqu)
|
||||
MNE(movhlpd)
|
||||
MNE(movhlps)
|
||||
MNE(movhpd)
|
||||
MNE(movhps)
|
||||
MNE(movlhpd)
|
||||
MNE(movlhps)
|
||||
MNE(movlpd)
|
||||
MNE(movlps)
|
||||
MNE(movmskpd)
|
||||
MNE(movmskps)
|
||||
MNE(movntdq)
|
||||
MNE(movntdqa)
|
||||
MNE(movnti)
|
||||
MNE(movntpd)
|
||||
MNE(movntps)
|
||||
MNE(movntq)
|
||||
MNE(movq)
|
||||
MNE(movq2dq)
|
||||
MNE(movs)
|
||||
MNE(movsbl)
|
||||
MNE(movsd)
|
||||
MNE(movshdup)
|
||||
MNE(movsldup)
|
||||
MNE(movslq)
|
||||
MNE(movss)
|
||||
MNE(movswl)
|
||||
MNE(movupd)
|
||||
MNE(movups)
|
||||
MNE(movzbl)
|
||||
MNE(movzwl)
|
||||
MNE(mpsadbw)
|
||||
MNE(mul)
|
||||
MNE(mulpd)
|
||||
MNE(mulps)
|
||||
MNE(mulsd)
|
||||
MNE(mulss)
|
||||
MNE(mwait)
|
||||
MNE(neg)
|
||||
MNE(nop)
|
||||
MNE(not)
|
||||
MNE(or)
|
||||
MNE(orpd)
|
||||
MNE(orps)
|
||||
MNE(out)
|
||||
MNE(outs)
|
||||
MNE(pabsb)
|
||||
MNE(pabsd)
|
||||
MNE(pabsw)
|
||||
MNE(packssdw)
|
||||
MNE(packsswb)
|
||||
MNE(packusdw)
|
||||
MNE(packuswb)
|
||||
MNE(paddb)
|
||||
MNE(paddd)
|
||||
MNE(paddq)
|
||||
MNE(paddsb)
|
||||
MNE(paddsw)
|
||||
MNE(paddusb)
|
||||
MNE(paddusw)
|
||||
MNE(paddw)
|
||||
MNE(palignr)
|
||||
MNE(pand)
|
||||
MNE(pandn)
|
||||
MNE(pause)
|
||||
MNE(pavgb)
|
||||
MNE(pavgw)
|
||||
MNE(pblendvb)
|
||||
MNE(pblendw)
|
||||
MNE(pcmpeqb)
|
||||
MNE(pcmpeqd)
|
||||
MNE(pcmpeqq)
|
||||
MNE(pcmpeqw)
|
||||
MNE(pcmpestri)
|
||||
MNE(pcmpestrm)
|
||||
MNE(pcmpgtb)
|
||||
MNE(pcmpgtd)
|
||||
MNE(pcmpgtq)
|
||||
MNE(pcmpgtw)
|
||||
MNE(pcmpistri)
|
||||
MNE(pcmpistrm)
|
||||
MNE(pextrw)
|
||||
MNE(phaddd)
|
||||
MNE(phaddsw)
|
||||
MNE(phaddw)
|
||||
MNE(phminposuw)
|
||||
MNE(phsubd)
|
||||
MNE(phsubsw)
|
||||
MNE(phsubw)
|
||||
MNE(pinsrb)
|
||||
MNE(pinsrd)
|
||||
MNE(pinsrw)
|
||||
MNE(pmaddubsw)
|
||||
MNE(pmaddwd)
|
||||
MNE(pmaxsb)
|
||||
MNE(pmaxsd)
|
||||
MNE(pmaxsw)
|
||||
MNE(pmaxub)
|
||||
MNE(pmaxud)
|
||||
MNE(pmaxuw)
|
||||
MNE(pminsb)
|
||||
MNE(pminsd)
|
||||
MNE(pminsw)
|
||||
MNE(pminub)
|
||||
MNE(pminud)
|
||||
MNE(pminuw)
|
||||
MNE(pmovmskb)
|
||||
MNE(pmovsxbd)
|
||||
MNE(pmovsxbq)
|
||||
MNE(pmovsxbw)
|
||||
MNE(pmovsxdq)
|
||||
MNE(pmovsxwd)
|
||||
MNE(pmovsxwq)
|
||||
MNE(pmovzxbd)
|
||||
MNE(pmovzxbq)
|
||||
MNE(pmovzxbw)
|
||||
MNE(pmovzxdq)
|
||||
MNE(pmovzxwd)
|
||||
MNE(pmovzxwq)
|
||||
MNE(pmuldq)
|
||||
MNE(pmulhrsw)
|
||||
MNE(pmulhuw)
|
||||
MNE(pmulhw)
|
||||
MNE(pmulld)
|
||||
MNE(pmullw)
|
||||
MNE(pmuludq)
|
||||
MNE(pop)
|
||||
MNE(popcnt)
|
||||
MNE(popf)
|
||||
MNE(por)
|
||||
MNE(prefetch)
|
||||
MNE(prefetchnta)
|
||||
MNE(prefetcht0)
|
||||
MNE(prefetcht1)
|
||||
MNE(prefetcht2)
|
||||
MNE(prefetchw)
|
||||
MNE(psadbw)
|
||||
MNE(pshufb)
|
||||
MNE(pshufd)
|
||||
MNE(pshufhw)
|
||||
MNE(pshuflw)
|
||||
MNE(pshufw)
|
||||
MNE(psignb)
|
||||
MNE(psignd)
|
||||
MNE(psignw)
|
||||
MNE(pslld)
|
||||
MNE(pslldq)
|
||||
MNE(psllq)
|
||||
MNE(psllw)
|
||||
MNE(psrad)
|
||||
MNE(psraw)
|
||||
MNE(psrld)
|
||||
MNE(psrldq)
|
||||
MNE(psrlq)
|
||||
MNE(psrlw)
|
||||
MNE(psubb)
|
||||
MNE(psubd)
|
||||
MNE(psubq)
|
||||
MNE(psubsb)
|
||||
MNE(psubsw)
|
||||
MNE(psubusb)
|
||||
MNE(psubusw)
|
||||
MNE(psubw)
|
||||
MNE(ptest)
|
||||
MNE(punpckhbw)
|
||||
MNE(punpckhdq)
|
||||
MNE(punpckhqdq)
|
||||
MNE(punpckhwd)
|
||||
MNE(punpcklbw)
|
||||
MNE(punpckldq)
|
||||
MNE(punpcklqdq)
|
||||
MNE(punpcklwd)
|
||||
MNE(push)
|
||||
MNE(pushf)
|
||||
MNE(pushq)
|
||||
MNE(pxor)
|
||||
MNE(rcl)
|
||||
MNE(rcpps)
|
||||
MNE(rcpss)
|
||||
MNE(rcr)
|
||||
MNE(rdmsr)
|
||||
MNE(rdpmc)
|
||||
MNE(rdtsc)
|
||||
MNE(ret)
|
||||
MNE(rol)
|
||||
MNE(ror)
|
||||
MNE(roundpd)
|
||||
MNE(roundps)
|
||||
MNE(roundsd)
|
||||
MNE(roundss)
|
||||
MNE(rsm)
|
||||
MNE(rsqrtps)
|
||||
MNE(rsqrtss)
|
||||
MNE(sahf)
|
||||
MNE(sar)
|
||||
MNE(sbb)
|
||||
MNE(scas)
|
||||
MNE(set)
|
||||
MNE(sfence)
|
||||
MNE(sgdt)
|
||||
MNE(shl)
|
||||
MNE(shld)
|
||||
MNE(shr)
|
||||
MNE(shrd)
|
||||
MNE(shufpd)
|
||||
MNE(shufps)
|
||||
MNE(sidt)
|
||||
MNE(sldt)
|
||||
MNE(smsw)
|
||||
MNE(sqrtpd)
|
||||
MNE(sqrtps)
|
||||
MNE(sqrtsd)
|
||||
MNE(sqrtss)
|
||||
MNE(stc)
|
||||
MNE(std)
|
||||
MNE(sti)
|
||||
MNE(stmxcsr)
|
||||
MNE(stos)
|
||||
MNE(str)
|
||||
MNE(sub)
|
||||
MNE(subpd)
|
||||
MNE(subps)
|
||||
MNE(subsd)
|
||||
MNE(subss)
|
||||
MNE(swapgs)
|
||||
MNE(syscall)
|
||||
MNE(sysenter)
|
||||
MNE(sysexit)
|
||||
MNE(sysret)
|
||||
MNE(test)
|
||||
MNE(ucomisd)
|
||||
MNE(ucomiss)
|
||||
MNE(ud2a)
|
||||
MNE(unpckhpd)
|
||||
MNE(unpckhps)
|
||||
MNE(unpcklpd)
|
||||
MNE(unpcklps)
|
||||
MNE(verr)
|
||||
MNE(verw)
|
||||
MNE(vmcall)
|
||||
MNE(vmclear)
|
||||
MNE(vmlaunch)
|
||||
MNE(vmptrld)
|
||||
MNE(vmptrst)
|
||||
MNE(vmread)
|
||||
MNE(vmresume)
|
||||
MNE(vmwrite)
|
||||
MNE(vmxoff)
|
||||
MNE(vmxon)
|
||||
MNE(wbinvd)
|
||||
MNE(wrmsr)
|
||||
MNE(xadd)
|
||||
MNE(xchg)
|
||||
MNE(xlat)
|
||||
MNE(xor)
|
||||
MNE(xorpd)
|
||||
MNE(xorps)
|
||||
-1632
File diff suppressed because it is too large
Load Diff
+104
@@ -1,3 +1,107 @@
|
||||
2023-09-27 Omar Sandoval <osandov@fb.com>
|
||||
|
||||
* libdwP.h ((Dwarf): Add elfpath.
|
||||
* dwarf_begin_elf.c (__libdw_debugdir): Replace declaration with...
|
||||
(__libdw_elfpath): New declaration.
|
||||
(__libdw_set_debugdir): New declaration.
|
||||
(__libdw_debugdir): Replace with..
|
||||
(__libdw_elfpath): New function.
|
||||
(__libdw_set_debugdir): New function.
|
||||
(valid_p): Call __libdw_elfpath and __libdw_set_debugdir instead of
|
||||
__libdw_debugdir.
|
||||
* dwarf_end.c (dwarf_end): Free dwarf->elfpath.
|
||||
|
||||
2023-09-27 Omar Sandoval <osandov@fb.com>
|
||||
|
||||
* libdw_find_split_unit.c (try_split_file): Make static.
|
||||
* dwarf_entrypc.c (dwarf_entrypc): Call dwarf_lowpc.
|
||||
* dwarf_ranges.c (dwarf_ranges): Use skeleton ranges section for
|
||||
skeleton units.
|
||||
* dwarf_macro_param2.c (dwarf_macro_param2): Change form condition to
|
||||
switch statement and add DW_FORM_line_strp, DW_FORM_strp_sup,
|
||||
DW_FORM_strx, and DW_FORM_strx[1-4].
|
||||
* dwarf_getmacros.c (get_macinfo_table): Replace assignment of
|
||||
table->is_64bit with assignments of table->address_size and
|
||||
table->offset_size. Assume default DW_AT_stmt_list of 0 for split
|
||||
DWARF. Set table->dbg.
|
||||
(get_table_for_offset): Ditto.
|
||||
(read_macros): Get fake CU offset_size from table->offset_size instead
|
||||
of table->is_64bit.
|
||||
* dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Get
|
||||
address_size for __libdw_getsrclines from table->address_size instead
|
||||
of table->is_64bit. Get dbg for __libdw_getsrclines from table->dbg
|
||||
instead of dbg parameter, which is now unused.
|
||||
* libdwP.h (Dwarf_Macro_Op_Table): Replace is_64bit with address_size
|
||||
and offset_size. Add dbg.
|
||||
Add IDX_debug_cu_index and IDX_debug_tu_index.
|
||||
* dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_cu_index and
|
||||
IDX_debug_tu_index.
|
||||
(scn_to_string_section_idx): Ditto.
|
||||
(scn_dwarf_type): Check for .debug_cu_index, .debug_tu_index,
|
||||
.zdebug_cu_index, and .zdebug_tu_index.
|
||||
(check_section): Change .dwo suffix matching to account for
|
||||
.debug_cu_index and .debug_tu_index.
|
||||
|
||||
2023-02-22 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_getscopes.c (origin_match): Don't free a->scopes.
|
||||
(dwarf_getscopes): Free a->scopes on error.
|
||||
|
||||
2023-02-20 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_begin_elf.c (check_section): Use elf_rawdata.
|
||||
|
||||
2023-02-14 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_getlocation.c (__libdw_intern_expression): Correct check
|
||||
for deref_type.
|
||||
|
||||
2023-02-10 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_getlocation.c (__libdw_intern_expression): Handle
|
||||
DW_OP_GNU_uninit.
|
||||
|
||||
2023-02-12 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* cfi.c (execute_cfi): Add cfi_asser before reading second lib128.
|
||||
* dwarf_chld.c (__libdw_find_attr): Check readp >= endp before
|
||||
calling get_uleb128.
|
||||
* dwarf_frame_register.c (dwarf_frame_register): Likewise for
|
||||
p >= end.
|
||||
* dwarf_getabbrev.c (__libdw_getabbrev): Add comment about check.
|
||||
* dwarf_getlocation.c (__libdw_intern_expression): Update check to
|
||||
account for both the number and uleb128.
|
||||
* encoded-value.h (read_encoded_value): Check p >= end for
|
||||
DW_EH_PE_(u|s)leb128.
|
||||
* fde.c (intern_fde): Check len can be read as uleb128.
|
||||
* libdw_form.c (__libdw_form_val_compute_len): Check valp >= endp
|
||||
before get_uleb128.
|
||||
|
||||
2023-01-22 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_getscopes.c (pc_record): Return nscopes when done.
|
||||
(dwarf_getscopes): Call __libdw_visit_scopes with
|
||||
inlined_origin CU.
|
||||
|
||||
2022-12-20 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* Makefile.am (AM_CPPFLAGS): Add -I$(srcdir)/../libebl.
|
||||
* cfi.c: Include libebl.h.
|
||||
* encoded-value.h: Likewise.
|
||||
* frame-cache.h: Likewise.
|
||||
|
||||
2022-10-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* memory-access.h (get_uleb128_step): Use __typeof.
|
||||
(get_sleb128_step): Likewise.
|
||||
(__libdw_get_sleb128) Likewise.
|
||||
(__libdw_get_sleb128_unchecked): Likewise.
|
||||
|
||||
2022-11-03 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* dwarf_next_cfi.c (dwarf_next_cfi): Don't dereference and assign
|
||||
bytes.
|
||||
|
||||
2022-10-21 Yonggang Luo <luoyonggang@gmail.com>
|
||||
|
||||
* dwarf_begin_elf.h: Don't include unistd.h and endian.h.
|
||||
|
||||
+3
-2
@@ -31,7 +31,7 @@ include $(top_srcdir)/config/eu.am
|
||||
if BUILD_STATIC
|
||||
AM_CFLAGS += $(fpic_CFLAGS)
|
||||
endif
|
||||
AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread
|
||||
AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libdw.a
|
||||
@@ -114,7 +114,8 @@ libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_
|
||||
libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
|
||||
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
|
||||
-Wl,--soname,$@.$(VERSION),--enable-new-dtags \
|
||||
-Wl,--version-script,$<,--no-undefined \
|
||||
-Wl,--version-script,$< \
|
||||
$(NO_UNDEFINED) \
|
||||
-Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \
|
||||
$(libdw_so_LDLIBS)
|
||||
@$(textrel_check)
|
||||
|
||||
+3
-1
@@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
#include "../libebl/libebl.h"
|
||||
#include "libebl.h"
|
||||
#include "cfi.h"
|
||||
#include "memory-access.h"
|
||||
#include "encoded-value.h"
|
||||
@@ -239,6 +239,7 @@ execute_cfi (Dwarf_CFI *cache,
|
||||
|
||||
case DW_CFA_offset_extended_sf:
|
||||
get_uleb128 (operand, program, end);
|
||||
cfi_assert (program < end);
|
||||
get_sleb128 (sf_offset, program, end);
|
||||
offset_extended_sf:
|
||||
offset = sf_offset * cie->data_alignment_factor;
|
||||
@@ -294,6 +295,7 @@ execute_cfi (Dwarf_CFI *cache,
|
||||
get_uleb128 (regno, program, end);
|
||||
/* DW_FORM_block is a ULEB128 length followed by that many bytes. */
|
||||
offset = program - (const uint8_t *) cache->data->d.d_buf;
|
||||
cfi_assert (program < end);
|
||||
get_uleb128 (operand, program, end);
|
||||
cfi_assert (operand <= (Dwarf_Word) (end - program));
|
||||
program += operand;
|
||||
|
||||
+87
-42
@@ -1,5 +1,6 @@
|
||||
/* Create descriptor from ELF descriptor for processing file.
|
||||
Copyright (C) 2002-2011, 2014, 2015, 2017, 2018 Red Hat, Inc.
|
||||
Copyright (C) 2023, Mark J. Wielaard <mark@klomp.org>
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
@@ -66,10 +67,38 @@ static const char dwarf_scnnames[IDX_last][19] =
|
||||
[IDX_debug_macro] = ".debug_macro",
|
||||
[IDX_debug_ranges] = ".debug_ranges",
|
||||
[IDX_debug_rnglists] = ".debug_rnglists",
|
||||
[IDX_debug_cu_index] = ".debug_cu_index",
|
||||
[IDX_debug_tu_index] = ".debug_tu_index",
|
||||
[IDX_gnu_debugaltlink] = ".gnu_debugaltlink"
|
||||
};
|
||||
#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
|
||||
|
||||
/* Map from section index to string section index.
|
||||
Non-string sections should have STR_SCN_IDX_last. */
|
||||
static const enum string_section_index scn_to_string_section_idx[IDX_last] =
|
||||
{
|
||||
[IDX_debug_info] = STR_SCN_IDX_last,
|
||||
[IDX_debug_types] = STR_SCN_IDX_last,
|
||||
[IDX_debug_abbrev] = STR_SCN_IDX_last,
|
||||
[IDX_debug_addr] = STR_SCN_IDX_last,
|
||||
[IDX_debug_aranges] = STR_SCN_IDX_last,
|
||||
[IDX_debug_line] = STR_SCN_IDX_last,
|
||||
[IDX_debug_line_str] = STR_SCN_IDX_debug_line_str,
|
||||
[IDX_debug_frame] = STR_SCN_IDX_last,
|
||||
[IDX_debug_loc] = STR_SCN_IDX_last,
|
||||
[IDX_debug_loclists] = STR_SCN_IDX_last,
|
||||
[IDX_debug_pubnames] = STR_SCN_IDX_last,
|
||||
[IDX_debug_str] = STR_SCN_IDX_debug_str,
|
||||
[IDX_debug_str_offsets] = STR_SCN_IDX_last,
|
||||
[IDX_debug_macinfo] = STR_SCN_IDX_last,
|
||||
[IDX_debug_macro] = STR_SCN_IDX_last,
|
||||
[IDX_debug_ranges] = STR_SCN_IDX_last,
|
||||
[IDX_debug_rnglists] = STR_SCN_IDX_last,
|
||||
[IDX_debug_cu_index] = STR_SCN_IDX_last,
|
||||
[IDX_debug_tu_index] = STR_SCN_IDX_last,
|
||||
[IDX_gnu_debugaltlink] = STR_SCN_IDX_last
|
||||
};
|
||||
|
||||
static enum dwarf_type
|
||||
scn_dwarf_type (Dwarf *result, size_t shstrndx, Elf_Scn *scn)
|
||||
{
|
||||
@@ -84,6 +113,11 @@ scn_dwarf_type (Dwarf *result, size_t shstrndx, Elf_Scn *scn)
|
||||
{
|
||||
if (startswith (scnname, ".gnu.debuglto_.debug"))
|
||||
return TYPE_GNU_LTO;
|
||||
else if (strcmp (scnname, ".debug_cu_index") == 0
|
||||
|| strcmp (scnname, ".debug_tu_index") == 0
|
||||
|| strcmp (scnname, ".zdebug_cu_index") == 0
|
||||
|| strcmp (scnname, ".zdebug_tu_index") == 0)
|
||||
return TYPE_DWO;
|
||||
else if (startswith (scnname, ".debug_") || startswith (scnname, ".zdebug_"))
|
||||
{
|
||||
size_t len = strlen (scnname);
|
||||
@@ -148,42 +182,34 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
|
||||
bool gnu_compressed = false;
|
||||
for (cnt = 0; cnt < ndwarf_scnnames; ++cnt)
|
||||
{
|
||||
/* .debug_cu_index and .debug_tu_index don't have a .dwo suffix,
|
||||
but they are for DWO. */
|
||||
if (result->type != TYPE_DWO
|
||||
&& (cnt == IDX_debug_cu_index || cnt == IDX_debug_tu_index))
|
||||
continue;
|
||||
bool need_dot_dwo =
|
||||
(result->type == TYPE_DWO
|
||||
&& cnt != IDX_debug_cu_index
|
||||
&& cnt != IDX_debug_tu_index);
|
||||
size_t dbglen = strlen (dwarf_scnnames[cnt]);
|
||||
size_t scnlen = strlen (scnname);
|
||||
if (strncmp (scnname, dwarf_scnnames[cnt], dbglen) == 0
|
||||
&& (dbglen == scnlen
|
||||
|| (scnlen == dbglen + 4
|
||||
&& ((!need_dot_dwo && dbglen == scnlen)
|
||||
|| (need_dot_dwo
|
||||
&& scnlen == dbglen + 4
|
||||
&& strstr (scnname, ".dwo") == scnname + dbglen)))
|
||||
{
|
||||
if (dbglen == scnlen)
|
||||
{
|
||||
if (result->type == TYPE_PLAIN)
|
||||
break;
|
||||
}
|
||||
else if (result->type == TYPE_DWO)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
else if (scnname[0] == '.' && scnname[1] == 'z'
|
||||
&& (strncmp (&scnname[2], &dwarf_scnnames[cnt][1],
|
||||
dbglen - 1) == 0
|
||||
&& (scnlen == dbglen + 1
|
||||
|| (scnlen == dbglen + 5
|
||||
&& ((!need_dot_dwo && scnlen == dbglen + 1)
|
||||
|| (need_dot_dwo
|
||||
&& scnlen == dbglen + 5
|
||||
&& strstr (scnname,
|
||||
".dwo") == scnname + dbglen + 1))))
|
||||
{
|
||||
if (scnlen == dbglen + 1)
|
||||
{
|
||||
if (result->type == TYPE_PLAIN)
|
||||
{
|
||||
gnu_compressed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (result->type <= TYPE_DWO)
|
||||
{
|
||||
gnu_compressed = true;
|
||||
break;
|
||||
}
|
||||
gnu_compressed = true;
|
||||
break;
|
||||
}
|
||||
else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
|
||||
&& startswith (scnname, ".gnu.debuglto_")
|
||||
@@ -218,8 +244,8 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the section data. */
|
||||
Elf_Data *data = elf_getdata (scn, NULL);
|
||||
/* Get the section data. Should be raw bytes, no conversion needed. */
|
||||
Elf_Data *data = elf_rawdata (scn, NULL);
|
||||
if (data == NULL)
|
||||
goto err;
|
||||
|
||||
@@ -230,27 +256,43 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
|
||||
/* We can now read the section data into results. */
|
||||
result->sectiondata[cnt] = data;
|
||||
|
||||
/* If the section contains string data, we want to know a size of a prefix
|
||||
where any string will be null-terminated. */
|
||||
enum string_section_index string_section_idx = scn_to_string_section_idx[cnt];
|
||||
if (string_section_idx < STR_SCN_IDX_last)
|
||||
{
|
||||
size_t size = data->d_size;
|
||||
/* Reduce the size by the number of non-zero bytes at the end of the
|
||||
section. */
|
||||
while (size > 0 && *((const char *) data->d_buf + size - 1) != '\0')
|
||||
--size;
|
||||
result->string_section_size[string_section_idx] = size;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* Helper function to set debugdir field. We want to cache the dir
|
||||
where we found this Dwarf ELF file to locate alt and dwo files. */
|
||||
char *
|
||||
__libdw_debugdir (int fd)
|
||||
__libdw_elfpath (int fd)
|
||||
{
|
||||
/* strlen ("/proc/self/fd/") = 14 + strlen (<MAXINT>) = 10 + 1 = 25. */
|
||||
char devfdpath[25];
|
||||
sprintf (devfdpath, "/proc/self/fd/%u", fd);
|
||||
char *fdpath = realpath (devfdpath, NULL);
|
||||
char *fddir;
|
||||
if (fdpath != NULL && fdpath[0] == '/'
|
||||
&& (fddir = strrchr (fdpath, '/')) != NULL)
|
||||
{
|
||||
*++fddir = '\0';
|
||||
return fdpath;
|
||||
}
|
||||
return NULL;
|
||||
return realpath (devfdpath, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__libdw_set_debugdir (Dwarf *dbg)
|
||||
{
|
||||
if (dbg->elfpath == NULL || dbg->elfpath[0] != '/')
|
||||
return;
|
||||
size_t dirlen = strrchr (dbg->elfpath, '/') - dbg->elfpath + 1;
|
||||
dbg->debugdir = malloc (dirlen + 1);
|
||||
if (dbg->debugdir == NULL)
|
||||
return;
|
||||
memcpy (dbg->debugdir, dbg->elfpath, dirlen);
|
||||
dbg->debugdir[dirlen] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +424,10 @@ valid_p (Dwarf *result)
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->debugdir = __libdw_debugdir (result->elf->fildes);
|
||||
{
|
||||
result->elfpath = __libdw_elfpath (result->elf->fildes);
|
||||
__libdw_set_debugdir(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -73,10 +73,13 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
|
||||
|
||||
if (attr_form == DW_FORM_indirect)
|
||||
{
|
||||
if (readp >= endp)
|
||||
goto invalid;
|
||||
get_uleb128 (attr_form, readp, endp);
|
||||
if (attr_form == DW_FORM_indirect ||
|
||||
attr_form == DW_FORM_implicit_const)
|
||||
{
|
||||
invalid:
|
||||
__libdw_seterrno (DWARF_E_INVALID_DWARF);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+2
-1
@@ -144,7 +144,8 @@ dwarf_end (Dwarf *dwarf)
|
||||
close (dwarf->alt_fd);
|
||||
}
|
||||
|
||||
/* The cached dir we found the Dwarf ELF file in. */
|
||||
/* The cached path and dir we found the Dwarf ELF file in. */
|
||||
free (dwarf->elfpath);
|
||||
free (dwarf->debugdir);
|
||||
|
||||
/* Free the context descriptor. */
|
||||
|
||||
@@ -37,12 +37,10 @@
|
||||
int
|
||||
dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
|
||||
return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_entry_pc,
|
||||
&attr_mem)
|
||||
?: INTUSE(dwarf_attr) (die, DW_AT_low_pc,
|
||||
&attr_mem),
|
||||
return_addr);
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
if ((attr = INTUSE(dwarf_attr) (die, DW_AT_entry_pc, &attr_mem)) != NULL)
|
||||
return INTUSE(dwarf_formaddr) (attr, return_addr);
|
||||
else
|
||||
return INTUSE(dwarf_lowpc) (die, return_addr);
|
||||
}
|
||||
INTDEF(dwarf_entrypc)
|
||||
|
||||
@@ -61,6 +61,9 @@ dwarf_formstring (Dwarf_Attribute *attrp)
|
||||
Elf_Data *data = ((attrp->form == DW_FORM_line_strp)
|
||||
? dbg_ret->sectiondata[IDX_debug_line_str]
|
||||
: dbg_ret->sectiondata[IDX_debug_str]);
|
||||
size_t data_size = ((attrp->form == DW_FORM_line_strp)
|
||||
? dbg_ret->string_section_size[STR_SCN_IDX_debug_line_str]
|
||||
: dbg_ret->string_section_size[STR_SCN_IDX_debug_str]);
|
||||
if (data == NULL)
|
||||
{
|
||||
__libdw_seterrno ((attrp->form == DW_FORM_line_strp)
|
||||
@@ -171,7 +174,7 @@ dwarf_formstring (Dwarf_Attribute *attrp)
|
||||
else
|
||||
off = read_8ubyte_unaligned (dbg, datap);
|
||||
|
||||
if (off > dbg->sectiondata[IDX_debug_str]->d_size)
|
||||
if (off >= data_size)
|
||||
goto invalid_offset;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,11 @@ dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op ops_mem[3],
|
||||
const uint8_t *p = fs->cache->data->d.d_buf + reg->value;
|
||||
const uint8_t *end = (fs->cache->data->d.d_buf
|
||||
+ fs->cache->data->d.d_size);
|
||||
if (p >= end)
|
||||
{
|
||||
__libdw_seterrno (DWARF_E_INVALID_DWARF);
|
||||
return -1;
|
||||
}
|
||||
get_uleb128 (block.length, p, end);
|
||||
block.data = (void *) p;
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ __libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
|
||||
+ dbg->sectiondata[IDX_debug_abbrev]->d_size);
|
||||
const unsigned char *start_abbrevp = abbrevp;
|
||||
unsigned int code;
|
||||
// We start off with abbrevp at offset, which is checked above.
|
||||
get_uleb128 (code, abbrevp, end);
|
||||
|
||||
/* Check whether this code is already in the hash table. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* Return list address ranges.
|
||||
Copyright (C) 2000-2010, 2016, 2017 Red Hat, Inc.
|
||||
Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
|
||||
|
||||
@@ -124,6 +125,10 @@ dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges, size_t *naranges)
|
||||
&& length <= DWARF3_LENGTH_MAX_ESCAPE_CODE))
|
||||
goto invalid;
|
||||
|
||||
const unsigned char *endp = readp + length;
|
||||
if (unlikely (endp > readendp))
|
||||
goto invalid;
|
||||
|
||||
if (unlikely (readp + 2 > readendp))
|
||||
goto invalid;
|
||||
|
||||
@@ -182,9 +187,17 @@ dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges, size_t *naranges)
|
||||
else
|
||||
range_length = read_8ubyte_unaligned_inc (dbg, readp);
|
||||
|
||||
/* Two zero values mark the end. */
|
||||
/* Two zero values mark the end. But in some cases (bugs)
|
||||
there might be such entries in the middle of the table.
|
||||
Ignore and continue, we'll check the actual length of
|
||||
the table to see if we are really at the end. */
|
||||
if (range_address == 0 && range_length == 0)
|
||||
break;
|
||||
{
|
||||
if (readp >= endp)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We don't use alloca for these temporary structures because
|
||||
the total number of them can be quite large. */
|
||||
|
||||
@@ -396,6 +396,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
|
||||
case DW_OP_form_tls_address:
|
||||
case DW_OP_GNU_push_tls_address:
|
||||
case DW_OP_stack_value:
|
||||
case DW_OP_GNU_uninit:
|
||||
/* No operand. */
|
||||
break;
|
||||
|
||||
|
||||
+23
-5
@@ -124,17 +124,24 @@ get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie)
|
||||
= INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem);
|
||||
Dwarf_Off line_offset = (Dwarf_Off) -1;
|
||||
if (attr != NULL)
|
||||
if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0))
|
||||
return NULL;
|
||||
{
|
||||
if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0))
|
||||
return NULL;
|
||||
}
|
||||
else if (cudie->cu->unit_type == DW_UT_split_compile
|
||||
&& dbg->sectiondata[IDX_debug_line] != NULL)
|
||||
line_offset = 0;
|
||||
|
||||
Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table,
|
||||
macinfo_data_size, 1);
|
||||
memcpy (table, macinfo_data, macinfo_data_size);
|
||||
|
||||
table->dbg = dbg;
|
||||
table->offset = macoff;
|
||||
table->sec_index = IDX_debug_macinfo;
|
||||
table->line_offset = line_offset;
|
||||
table->is_64bit = cudie->cu->address_size == 8;
|
||||
table->address_size = cudie->cu->address_size;
|
||||
table->offset_size = cudie->cu->offset_size;
|
||||
table->comp_dir = __libdw_getcompdir (cudie);
|
||||
|
||||
return table;
|
||||
@@ -182,6 +189,15 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint8_t address_size;
|
||||
if (cudie != NULL)
|
||||
address_size = cudie->cu->address_size;
|
||||
else
|
||||
{
|
||||
char *ident = elf_getident (dbg->elf, NULL);
|
||||
address_size = ident[EI_CLASS] == ELFCLASS32 ? 4 : 8;
|
||||
}
|
||||
|
||||
/* """The macinfo entry types defined in this standard may, but
|
||||
might not, be described in the table""".
|
||||
|
||||
@@ -253,12 +269,14 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff,
|
||||
macop_table_size, 1);
|
||||
|
||||
*table = (Dwarf_Macro_Op_Table) {
|
||||
.dbg = dbg,
|
||||
.offset = macoff,
|
||||
.sec_index = IDX_debug_macro,
|
||||
.line_offset = line_offset,
|
||||
.header_len = readp - startp,
|
||||
.version = version,
|
||||
.is_64bit = is_64bit,
|
||||
.address_size = address_size,
|
||||
.offset_size = is_64bit ? 8 : 4,
|
||||
|
||||
/* NULL if CUDIE is NULL or DW_AT_comp_dir is absent. */
|
||||
.comp_dir = __libdw_getcompdir (cudie),
|
||||
@@ -368,7 +386,7 @@ read_macros (Dwarf *dbg, int sec_index,
|
||||
.dbg = dbg,
|
||||
.sec_idx = sec_index,
|
||||
.version = table->version,
|
||||
.offset_size = table->is_64bit ? 8 : 4,
|
||||
.offset_size = table->offset_size,
|
||||
.str_off_base = str_offsets_base_off (dbg, (cudie != NULL
|
||||
? cudie->cu: NULL)),
|
||||
.startp = (void *) startp + offset,
|
||||
|
||||
+13
-9
@@ -1,5 +1,6 @@
|
||||
/* Return scope DIEs containing PC address.
|
||||
Copyright (C) 2005, 2007, 2015 Red Hat, Inc.
|
||||
Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
@@ -100,7 +101,7 @@ origin_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
|
||||
Dwarf_Die *scopes = realloc (a->scopes, nscopes * sizeof scopes[0]);
|
||||
if (scopes == NULL)
|
||||
{
|
||||
free (a->scopes);
|
||||
/* a->scopes will be freed by dwarf_getscopes on error. */
|
||||
__libdw_seterrno (DWARF_E_NOMEM);
|
||||
return -1;
|
||||
}
|
||||
@@ -173,12 +174,8 @@ pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
|
||||
/* Not there yet. */
|
||||
return 0;
|
||||
|
||||
/* Now we are in a scope that contains the concrete inlined instance.
|
||||
Search it for the inline function's abstract definition.
|
||||
If we don't find it, return to search the containing scope.
|
||||
If we do find it, the nonzero return value will bail us out
|
||||
of the postorder traversal. */
|
||||
return __libdw_visit_scopes (depth, die, NULL, &origin_match, NULL, a);
|
||||
/* This is the innermost inline scope, we are done here. */
|
||||
return a->nscopes;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,11 +190,18 @@ dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, Dwarf_Die **scopes)
|
||||
|
||||
int result = __libdw_visit_scopes (0, &cu, NULL, &pc_match, &pc_record, &a);
|
||||
|
||||
if (result == 0 && a.scopes != NULL)
|
||||
result = __libdw_visit_scopes (0, &cu, NULL, &origin_match, NULL, &a);
|
||||
if (result >= 0 && a.scopes != NULL && a.inlined > 0)
|
||||
{
|
||||
/* We like the find the inline function's abstract definition
|
||||
scope, but that might be in a different CU. */
|
||||
cu.die = CUDIE (a.inlined_origin.cu);
|
||||
result = __libdw_visit_scopes (0, &cu, NULL, &origin_match, NULL, &a);
|
||||
}
|
||||
|
||||
if (result > 0)
|
||||
*scopes = a.scopes;
|
||||
else if (result < 0)
|
||||
free (a.scopes);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -129,6 +129,12 @@ add_new_line (struct line_state *state, struct linelist *new_line)
|
||||
return true; \
|
||||
} while (0)
|
||||
|
||||
/* Same as above, but don't flag as "invalid" just use truncated
|
||||
value. Used for discriminator for which llvm might use a value
|
||||
that won't fit 24 bits. */
|
||||
#define SETX(field) \
|
||||
new_line->line.field = state->field; \
|
||||
|
||||
SET (addr);
|
||||
SET (op_index);
|
||||
SET (file);
|
||||
@@ -140,7 +146,7 @@ add_new_line (struct line_state *state, struct linelist *new_line)
|
||||
SET (prologue_end);
|
||||
SET (epilogue_begin);
|
||||
SET (isa);
|
||||
SET (discriminator);
|
||||
SETX (discriminator);
|
||||
SET (context);
|
||||
SET (function_name);
|
||||
|
||||
@@ -572,6 +578,8 @@ read_srclines (Dwarf *dbg,
|
||||
goto invalid_data;
|
||||
|
||||
size_t nfiles;
|
||||
if ((size_t) (lineendp - linep) < 1)
|
||||
goto invalid_data;
|
||||
get_uleb128 (nfiles, linep, lineendp);
|
||||
|
||||
if (nforms == 0 && nfiles != 0)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user