Commit Graph

86 Commits

Author SHA1 Message Date
zhanghaibo e660ab2124 upgrade to v0.188
Signed-off-by: zhanghaibo <zhanghaibo0@huawei.com>
Change-Id: I83c8756f5ce0a464b037bc963cfdce43df82921b
2023-04-25 18:45:37 +08:00
zhanghaibo 4120cecb42 add files generated from source code
Signed-off-by: zhanghaibo <zhanghaibo0@huawei.com>
2023-02-25 10:46:51 +08:00
Dmitry V. Levin 05c232f7fd Split the top level .gitignore file
Move subdirectory parts of the top level .gitignore into appropriate
subdirectories.  This would be consistent with ChangeLog files,
currently one has to update the top level ChangeLog file when
the top level .gitignore file is changed in a way that affects
a specific subdirectory only.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-20 08:00:00 +00:00
Érico Rolim 47516d457a libcpu: linking i386_gendis requires obstack.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-12-16 22:45:44 +01:00
Dmitry V. Levin e1174a5f2c libcpu: consistently use _(Str) instead of gettext(Str)
eu-config.h defines _(Str) to dgettext ("elfutils", Str) instead of
a simple gettext (Str) for a reason: the library might be indirectly
used by clients that called bindtextdomain with a domain different
from "elfutils".

The change was made automatically using the following command:
$ git grep -l '\<gettext *(' libcpu |xargs sed -i 's/\<gettext *(/_(/g'

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-16 10:01:52 +00:00
Dmitry V. Levin 21692163d6 libcpu: fix spelling typos in comments
layed -> laid
adressing -> addressing

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-12 18:06:28 +01:00
Mark Wielaard 5d3b808238 libcpu: Free unused new bitfield on error in i386_parse.y new_bitfield.
GCC10 -fanalyzer detected we didn't free the newly created bitfield
on error. Make sure to free it before returning.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-05-14 14:30:57 +02:00
Mark Wielaard 25d40a626d libcpu: Replace assert with goto invalid_op for bad prefix.
https://sourceware.org/bugzilla/show_bug.cgi?id=25831

Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-04-21 22:23:18 +02:00
Omar Sandoval 277c2c54f5 libcpu: Compile i386_lex.c with -Wno-implicit-fallthrough
elfutils is compiled with -Wimplicit-fallthrough=5, so the fallthrough
comment in i386_lex.c (generated by flex) doesn't prevent the implicit
fallthrough warning. Add -Wno-implicit-fallthrough to i386_lex_CFLAGS.

Signed-off-by: Omar Sandoval <osandov@fb.com>
2019-12-12 12:12:11 +01:00
Mark Wielaard 99dc63b10b libcpu: Fix bounds checks and replace asserts with errors.
Add a missing bounds check, fix an off-by-one bounds check and replace
asserts with error messages.

https://sourceware.org/bugzilla/show_bug.cgi?id=25068

Signed-off-by: Mark Wielaard <mark@klomp.org>
2019-10-26 02:28:48 +02:00
Mark Wielaard 65a29626e3 libcpu: Make sure left shifts are done in unsigned context.
Use UINT64_C (0) instead of INT64_C (0) to make sure the calculation
is done on unsigned values. Otherwise the gcc undefined sanitizer will
warn:

libcpu/riscv_disasm.c:457:57: runtime error: left shift of negative value -1

Signed-off-by: Mark Wielaard <mark@klomp.org>
2019-09-07 21:45:31 +02:00
Ulrich Drepper 2dc2ed67b1 Fix whitespaces in RISC-V disasm code 2019-09-07 11:06:13 +02:00
Ulrich Drepper fcab4f6587 Implement RISC-V disassembler 2019-09-06 23:49:54 +02:00
Omar Sandoval 823ee0c48e Add PIC and non-PIC variants of libcpu and libebl
Currently, libcpu and libebl are always compiled as PIC. An upcoming
change will add the objects from libcpu.a and libebl.a to libdw.a, which
should not be PIC unless configured that way. So, make libcpu.a and
libebl.a non-PIC and add libcpu_pic.a and libebl_pic.a.

Signed-off-by: Omar Sandoval <osandov@fb.com>
2019-08-28 21:45:26 +02:00
Omar Sandoval 4fcb7ec9d7 libcpu: merge libcpu_{i386,x86_64,bpf} into one library
In preparation for combining the libebl backend modules, combine all of
the libcpu backends into libcpu.a.

Signed-off-by: Omar Sandoval <osandov@fb.com>
2019-08-28 21:29:18 +02:00
Mark Wielaard cff53f1784 libcpu: Recognize bpf jump variants BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLE
Linux kernel 4.13 introduced 4 more jump class variants.

  commit 92b31a9af73b3a3fc801899335d6c47966351830
  Author: Daniel Borkmann <daniel@iogearbox.net>
  Date:   Thu Aug 10 01:39:55 2017 +0200

    bpf: add BPF_J{LT,LE,SLT,SLE} instructions

For conditional jumping on unsigned and signed < and <= between a register
and another register or immediate.

Add these new constants to bpf.h, recognize them in bpf_disasm and update
the testfile-bpf-dis1.expect file.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2018-11-09 18:26:38 +01:00
Ross Burton e893aab0d1 Consolidate error.h inclusion in system.h
error.h isn't standard and so isn't part of the musl C library.
To easy future porting, consolidate the inclusion of error.h into system.h.

https://sourceware.org/bugzilla/show_bug.cgi?id=21008

Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-07-05 21:06:40 +02:00
Joshua Watt 555e15ebe8 Use fallthrough attribute.
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.

The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.

Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2018-02-10 03:19:26 +01:00
Ulf Hermann 17d7194d29 Make sure packed structs follow the gcc memory layout
gcc defaults to using struct layouts that follow the native conventions,
even if __attribute__((packed)) is given. In order to get the layout we
expect, we need to tell gcc to always use the gcc struct layout, at
least for packed structs. To do this, we can use the gcc_struct
attribute.

This is important, not only for porting to windows, but also potentially
for other platforms, as the bugs resulting from struct layout
differences are rather subtle and hard to find.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
2017-09-20 21:40:31 +02:00
Ulf Hermann 07737584e7 Check for -z,defs, -z,relro, -fPIC, -fPIE before using them
Those flags are not available on all platforms, and omitting them when
not available will not cause any harm. In particular:

-z,defs disallows undefined symbols in object files. This option is
unsupported if the target binary format enforces the same condition
already. Furthermore it is only a compile time sanity check. When it is
omitted, the same binary is produced.

-z,relro instructs the loader to mark sections read-only after loading
the library, where possible. This is a hardening mechanism. If it is
unavailable, the functionality of the code is not affected in any way.

-fPIC instructs the compiler to produce position independent code. While
this is preferable to relocatable code, relocatable code also works and
may even be faster. Relocatable code might just be loaded into memory
multiple times for different processes.

-fPIE is the same thing as -fPIC for executables rather than shared
libraries.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
2017-08-18 22:29:46 +02:00
Mark Wielaard 1609679b1e backends: Don't depend on linux/bpf.h to compile bpf disassembler.
We only need a few constants and one structure definition from linux/bpf.
Just define those in a local lib/bpf.h file. This makes sure the bpf
disassembler is always build and included even when elfutils is build
on older GNU/Linux systems (and even on other platforms).

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-07-24 12:06:14 +02:00
Ulf Hermann 28149ca817 Add EXEEXT to gendis
Otherwise the build will fail on systems that actually need file
extension for executables.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
2017-04-26 17:22:15 +02:00
Ulf Hermann 4159aa62cc Don't use comparison_fn_t
Not all search.h declare it, and it is not very helpful anyway.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
2017-04-26 00:17:11 +02:00
Mark Wielaard a3cc8182b2 Add GCC7 -Wimplicit-fallthrough support/fixes.
GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one
small buglet in elflint option procession. So it seems useful to enable
to make sure all swatch case fallthroughs are deliberate.

Add configure check to detect whether gcc support -Wimplicit-fallthrough
and enable it. Add fixes and explicit fallthrough comments where necessary.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-11-10 11:59:00 +01:00
Akihiko Odaki 60b2bf1b08 lib: Provide MAX and MIN in system.h
This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.

Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
2016-10-12 15:43:14 +02:00
Mark Wielaard 4f7b5ba962 libcpu: Fix build of bpf_disasm.c for kernels < 3.20.
Before linux 3.20 the BPF_PSEUDO_MAP_FD constant wasn't defined.

Reported-by: Julian Ospald <hasufell@posteo.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-09-05 11:15:50 +02:00
Richard Henderson a8b2529fac Fix bpf disassembler for _FORTIFY_SOURCE
It's illegal to skip positional operands for printf.  Rearrange the
printing of the instructions to use exactly the operands required.

Also, fix printing of mod operations: s/%/%%/ in the print format.
Also, fix printing of endian operations: remove extra spaces.
2016-08-11 02:28:32 +02:00
Richard Henderson 9a36c9226c Add support for BPF
Signed-off-by: Richard Henderson <rth@redhat.com>
2016-06-28 20:09:11 +02:00
Josh Stone daee4714ee Improve AM_SILENT_RULES coverage
Note, elfutils does not explicitly enable AM_SILENT_RULES.  It's only
available starting from automake 1.11, but starting from automake 1.13
silent rules are always generated, defaulting to verbose.  $(AM_V_foo)
additions should be no-ops on systems that don't support silent rules.

To be silent, use "./configure --enable-silent-rules" or "make V=0".

Signed-off-by: Josh Stone <jistone@redhat.com>
2015-10-06 17:50:10 -07:00
Jose E. Marchesi 133509fa40 Use -fPIC instead of -fpic when generating PIC code.
This avoids relocation overflows in sparc/sparc64 targets while
linking,  where the reachable data using -fpic is only 4kb.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
2015-10-06 23:40:19 +02:00
Mark Wielaard 3232479483 Remove mudflap build option.
The --enable-mudflap configure build has been broken for 2 years without
anybody apparently noticing. GCC 4.9 removed mudflap support. Before
release we now run make distcheck with valgrind support. Removal of the
mudflap configure option simplifies the build a little.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-04-18 11:46:51 +02:00
Mark Wielaard cdaaf2153a Updates for Automake 1.13.
autoreconf will install config/test-driver, ignore it.
Update gettext m4 and po files to version 0.18.2.
Use AM_CPPFLAGS instead of INCLUDES.
All changes are backward compatible with Automake 1.11.
2013-04-26 10:06:08 +02:00
Roland McGrath 960a6aff19 Robustify makefile redirection use. 2012-10-10 09:31:42 -07:00
Roland McGrath b2589ffa7c Add a rule to make build failure w/o --enable-maintainer-mode clearer. 2012-06-26 18:09:10 -07:00
Mark Wielaard de2ed97f33 Update name, license and contributor policy.
* Change name from "Red Hat elfutils" to "elfutils".
* Update license of standalone tools and test from GPLv2 to GPLv3+.
* Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+.
* Add Developer Certificate of Origin based contributor policy.

top-level:

- COPYING: Upgraded from GPLv2 to GPLv3.
- CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files.
- NEWS: Added note about new contribution and license policy.
- Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST.
- configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'.

backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf:

- All files updated to GPLv2/LGPLv3+. Except some very small files
  (<5 lines) which didn't have any headers at all before, the linker
  .maps files and the libcpu/defs files which only contain data and
  libelf/elf.h which comes from glibc and is under LGPLv2+.

config:

- elfutils.spec.in: Add new License: headers and new %doc files.
- Update all license headers to GPLv2/LGPLv3+ for files used by libs.

src, tests:

- All files updated to GPLv3+. Except for the test bz2 data files, the
  linker maps and script files and some very small files (<5 lines)
  that don't have any headers.

Signed-off-by: Richard Fontana <rfontana@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2012-06-05 23:12:05 +02:00
Mark Wielaard 5128fb4487 Remove .mtn-ignore and .cvsignore files.
We use .gitignore these days.
2012-06-05 14:55:29 +02:00
Mark Wielaard 5e56a1efb6 libcpu Makefile.am, move %_dis.h from CLEANFILES to MAINTAINERCLEANFILES. 2012-02-24 23:41:53 +01:00
Ulrich Drepper c6b3d0c278 Color code output of nm and objdump 2012-01-21 18:14:39 -05:00
Roland McGrath a9cefae36d Include *_dis.h headers in dist; generate them only for --enable-maintainer-mode. 2011-10-16 09:24:27 -07:00
Roland McGrath 10eb76b853 Clean up libcpu makefile rules for better error detection. 2010-08-16 22:48:48 -07:00
Roland McGrath 22359e2653 Clean up and consolidate automake magic to reduce duplication and to work with --disable-dependency-tracking. 2010-02-15 15:57:03 -08:00
Roland McGrath eb9ba470ff Nominal ARM support. 2009-04-15 02:10:30 -07:00
Roland McGrath 78df7965cb Use quotes around command substitution that can produce leading whitespace. 2009-01-23 16:39:42 -08:00
Ulrich Drepper 92287fdf5b Optimize x86/x86-64 disassembler tables. 2009-01-01 20:18:48 -08:00
Ulrich Drepper 3bf5759aa0 Add Intel SSE4 support to disassembler. 2009-01-01 18:52:05 -08:00
Ulrich Drepper a492e8ec78 Replay output operations correctly when internal buffer in x86/x86-64
disasembler code is full.
2008-12-31 12:03:45 -08:00
Ulrich Drepper 4692d8160c Slightly better formatting in generating disassembly data. 2008-12-31 11:42:06 -08:00
Ulrich Drepper 71696bafdb Optimize x86/x86-64 disassembler some more. Avoid relocations for string
table.
2008-12-31 11:34:47 -08:00
Ulrich Drepper 54a6d4b1b6 Fix printing of rex prefix in x86-64 disassembler. 2008-12-31 10:21:51 -08:00
Ulrich Drepper 98c245eb57 Optimize x86/x86-64 disassembler a bit. 2008-12-31 10:15:30 -08:00