summaryrefslogtreecommitdiff
path: root/libcpu
Commit message (Collapse)AuthorAgeFilesLines
* libcpu: Remove the need of NMNES by using enumYonggang Luo2023-02-235-21/+60
| | | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Use __asm instead of asm to mark variables as usedYonggang Luo2022-12-212-2/+6
| | | | | | | This block of code can not be removed. As it's contains a goto label enomem that been used elsewhere. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* Do not use relative include paths in library files.Mark Wielaard2022-12-204-4/+10
| | | | | | | | | Rely on include dirs being set up correctly. Setup libdw AM_CPPFLAGS to include libebl directory. In libdwfl note that debuginfod.h is a generated file in the builddir. Only include it in the one file debuginfod-client.c that really needs it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Use "#define FCT_mod$64r_m FCT_mod$r_m" in i386_data.hYonggang Luo2022-12-122-1/+5
| | | | | | This is enough and can be recognized by clang-cl on windows Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* lib{asm,cpu,dw,dwfl,dwelf}: Move platform depended include into system.hYonggang Luo2022-10-283-3/+7
| | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* Strip __ prefix from __BYTE_ORDER __LITTLE_ENDIAN and __BIG_ENDIANYonggang Luo2022-10-174-15/+20
| | | | | | | | __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are defined by the gcc/clang preprocessor. BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN are defined in <endian.h>. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* Move the #include <libintl.h> into eu-config.hYonggang Luo2022-10-162-2/+0
| | | | | | | | | | So we do not need include in each file. And indeed the macro #define _(Str) dgettext ("elfutils", Str) access libintl function dgettext, so it's make more sense #include <libintl.h> in file eu-config.h Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* configure: Add --enable-sanitize-addressMark Wielaard2021-12-092-1/+14
| | | | | | | | | | | | | | | | --enable-sanitize-address makes sure that all code is compiled with -fsanitizer=address and all tests run against libasan. It can be combined with --enable-sanitize-undefined, but not with --enable-valgrind. In maintainer mode there is one program that causes leaks, i386_gendis, so disable leak detection for that program. One testcase, test_nlist, needs special linker flags, make sure it also uses -fsanitizer=address when using the address sanitizer. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Split the top level .gitignore fileDmitry V. Levin2020-12-202-0/+9
| | | | | | | | | | 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>
* libcpu: linking i386_gendis requires obstack.Érico Rolim2020-12-162-1/+5
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-163-4/+9
| | | | | | | | | | | | 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>
* libcpu: fix spelling typos in commentsDmitry V. Levin2020-12-123-2/+7
| | | | | | | layed -> laid adressing -> addressing Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libcpu: Free unused new bitfield on error in i386_parse.y new_bitfield.Mark Wielaard2020-05-142-0/+5
| | | | | | | 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>
* libcpu: Replace assert with goto invalid_op for bad prefix.Mark Wielaard2020-04-212-4/+12
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=25831 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Compile i386_lex.c with -Wno-implicit-fallthroughOmar Sandoval2019-12-122-1/+6
| | | | | | | | 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>
* libcpu: Fix bounds checks and replace asserts with errors.Mark Wielaard2019-10-263-5/+17
| | | | | | | | | 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>
* libcpu: Make sure left shifts are done in unsigned context.Mark Wielaard2019-09-072-1/+6
| | | | | | | | | | 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>
* Fix whitespaces in RISC-V disasm codeUlrich Drepper2019-09-071-38/+38
|
* Implement RISC-V disassemblerUlrich Drepper2019-09-063-2/+1503
|
* Add PIC and non-PIC variants of libcpu and libeblOmar Sandoval2019-08-282-5/+15
| | | | | | | | | 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>
* libcpu: merge libcpu_{i386,x86_64,bpf} into one libraryOmar Sandoval2019-08-282-7/+9
| | | | | | | 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>
* libcpu: Recognize bpf jump variants BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLEMark Wielaard2018-11-092-1/+30
| | | | | | | | | | | | | | | | | | 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>
* Consolidate error.h inclusion in system.hRoss Burton2018-07-053-4/+2
| | | | | | | | | 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>
* Use fallthrough attribute.Joshua Watt2018-02-102-1/+6
| | | | | | | | | | | | | | | 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>
* Make sure packed structs follow the gcc memory layoutUlf Hermann2017-09-202-1/+5
| | | | | | | | | | | | | | 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>
* Check for -z,defs, -z,relro, -fPIC, -fPIE before using themUlf Hermann2017-08-182-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* backends: Don't depend on linux/bpf.h to compile bpf disassembler.Mark Wielaard2017-07-243-8/+7
| | | | | | | | | 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>
* Add EXEEXT to gendisUlf Hermann2017-04-262-3/+7
| | | | | | | Otherwise the build will fail on systems that actually need file extension for executables. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't use comparison_fn_tUlf Hermann2017-04-262-2/+6
| | | | | | Not all search.h declare it, and it is not very helpful anyway. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
* Add GCC7 -Wimplicit-fallthrough support/fixes.Mark Wielaard2016-11-102-2/+6
| | | | | | | | | | | 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>
* lib: Provide MAX and MIN in system.hAkihiko Odaki2016-10-124-3/+8
| | | | | | | | | | 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>
* libcpu: Fix build of bpf_disasm.c for kernels < 3.20.Mark Wielaard2016-09-052-0/+8
| | | | | | | 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>
* Fix bpf disassembler for _FORTIFY_SOURCERichard Henderson2016-08-112-174/+372
| | | | | | | | 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.
* Add support for BPFRichard Henderson2016-06-284-1/+303
| | | | Signed-off-by: Richard Henderson <rth@redhat.com>
* Improve AM_SILENT_RULES coverageJosh Stone2015-10-062-5/+11
| | | | | | | | | | | 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>
* Use -fPIC instead of -fpic when generating PIC code.Jose E. Marchesi2015-10-062-1/+6
| | | | | | | 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>
* Remove mudflap build option.Mark Wielaard2014-04-182-1/+5
| | | | | | | | | 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>
* Updates for Automake 1.13.Mark Wielaard2013-04-262-1/+5
| | | | | | | 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.
* Robustify makefile redirection use.Roland McGrath2012-10-102-2/+9
|
* Add a rule to make build failure w/o --enable-maintainer-mode clearer.Roland McGrath2012-06-262-1/+12
|
* Update name, license and contributor policy.Mark Wielaard2012-06-058-125/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Remove .mtn-ignore and .cvsignore files.Mark Wielaard2012-06-051-1/+0
| | | | We use .gitignore these days.
* libcpu Makefile.am, move %_dis.h from CLEANFILES to MAINTAINERCLEANFILES.Mark Wielaard2012-02-242-1/+7
|
* Color code output of nm and objdumpUlrich Drepper2012-01-212-5/+102
|
* Include *_dis.h headers in dist; generate them only for ↵Roland McGrath2011-10-162-9/+21
| | | | --enable-maintainer-mode.
* Clean up libcpu makefile rules for better error detection.Roland McGrath2010-08-162-9/+15
|
* Clean up and consolidate automake magic to reduce duplication and to work ↵Roland McGrath2010-02-152-18/+10
| | | | with --disable-dependency-tracking.
* Nominal ARM support.Roland McGrath2009-04-152-0/+6
|
* Use quotes around command substitution that can produce leading whitespace.Roland McGrath2009-01-232-2/+7
|
* Optimize x86/x86-64 disassembler tables.Ulrich Drepper2009-01-013-11/+44
|