| Commit message (Collapse) | Author | Age | Files | Lines |
| |\
| |
| |
| |
| |
| | |
elfutils 0.170 release
Change-Id: I37d03645902b9f0a9fb708af1551db8843537799
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since POWER8, PowerPC 64 supports Hardware Transactional Memory, which has
three special purpose registers associated to it: tfhar, tfiar, and texasr.
This commit add HTM SPRs set as known note type so it's possible to use
'readelf --notes' to inspect the HTM SPRs in a coredump file generated in
such a machines.
Signed-off-by: Gustavo Romero <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Link them all with -z,defs,-z,relro,--no-undefined, provide complete
dependencies for the link steps, and add libeu.a to each one. libeu.a
contains useful library functionality that each of them might use. The
linker will strip unneeded symbols, so linking it in won't hurt even if
none of the functions are used.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
ChangeLog
backends/ChangeLog
config/ChangeLog
lib/ChangeLog
libasm/ChangeLog
libcpu/ChangeLog
libdw/ChangeLog
libdwfl/ChangeLog
libdwfl/derelocate.c
libdwfl/linux-kernel-modules.c
libebl/ChangeLog
libelf/ChangeLog
src/ChangeLog
tests/ChangeLog
Change-Id: I3b7ced947c6498290aaae27443985b84531f0bcd
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.
In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.
Signed-off-by: Ulf Hermann <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| | |
F_GETFD is both cheaper and easier to port, and otherwise has the same
effect here.
Signed-off-by: Ulf Hermann <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
__attribute__ is a GNU extension. If we want to link against the
libraries using a different compiler, it needs to be disabled. It was
already disabled in libdw.h, and this patch extends this to the other
headers. We move the defines to libelf.h as that is included in all
the others.
Signed-off-by: Ulf Hermann <[email protected]>
|
| | |
| |
| |
| |
| |
| | |
Otherwise we skip the munmap() later. This leaks resources.
Signed-off-by: Ulf Hermann <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When building with gcc -Os it seems we can inline read_number_entries
but if that function fails then n will not be initialized. GCC seems not
to realize that in that case n won't be used at all. Explicitly initialize
n to zero to prevent a spurious error: 'n' may be used uninitialized in
this function [-Werror=maybe-uninitialized] in that case.
https://sourceware.org/bugzilla/show_bug.cgi?id=21011
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
If O_BINARY is not defined, define it to 0, so that the change has no
effect then. Some systems have separate binary and text modes for files,
and we don't want the text mode to be used.
Change-Id: If7efb5bd448c2a1c7d1eb5dab276849b1b15a3ce
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If fchmod or fchown are unavailable, then the file permission model is
likely to be different from what we expect there. posix_fallocate is a
rather fragile affair already on linux, and not guaranteed to do
anything useful. If it's not available, the result will be the same as
when it's available and unreliable. fadvise is an optimization.
Change-Id: I28a77e976a0198cf80397b45eb1bc8cfb30664f5
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On windows there is no features.h, uid_t, gid_t, mode_t, and pid_t are
not defined and there is also no elf.h. To make it possible to build
other software against libelf and libdw, install our own version of
elf.h, and a bare-bones features.h that provides exactly the above
declarations.
Change-Id: I9df3c8cbffe431b8b6834dbd2246e38df4f5e172
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
We don't use those anywhere else. Also, put the 'extern "C"' after the
included headers.
Change-Id: I3b9fd0d86f148ac770e9335eeb873e8bc7cbb60b
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
On windows gcc by default generates code that follows the MSVC layout.
We don't want that as it adds extra padding.
Change-Id: I92efe5da2a2ad818783707ee96a9b8e0eb606dbd
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| | |
MSVC needs them to link against .dll files.
Change-Id: Iaf15391d28e0cd3292903dda2cd74b8b99a94274
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
On windows library names end with ".dll" and the prefix "lib" us usually
omitted. Take this into account and also drop the $(EXEEXT) workaround.
We don't need to use noinst_PROGRAMS as there is also noinst_DATA.
Change-Id: I7e4ba2432811d5ad85051ea0c9d5674eabf79b3c
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
We might not have gettext available from libc and we cannot get it from
gnulib either.
Change-Id: I1cc657b13b97bcc7c0f158f11b6702c24e69695c
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
If so, define attribute_hidden to be empty. Also, use attribute_hidden
in all places where we hide symbols.
Change-Id: I37353459710dbbd1c6c6c46110514fc18515c814
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
On windows those aren't needed because the link results are no ELF
files and all code is position independent anyway. gcc then complains
about them, which is in turn caught by -Werror.
Change-Id: Ie3d600b7c430698fc3d867a986a4d48f7ad1bbec
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
mempcpy, memrchr, rawmemchr, and argp are provided by gnulib now. We
don't need to define them locally and we don't need to search for an
external libargp.
Change-Id: I131ca4bc2d77c597b99c296c28259a3600e5d1b5
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This enables us to build a fully featured elfutils package on systems
with reduced C libraries, such as windows. All the modules are built
into libgnu.a, which is then linked into all binaries if
--enable-gnulib is given on the configure line.
Change-Id: I743fd22172bc85d9f10dcc3dad8eb921f462b554
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| | |
Otherwise we skip the munmap() later. This leaks resources.
Change-Id: I9e04ea3f0a608e88c474379df19c41261ecd092e
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.
In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.
Change-Id: Ib78dd7e058ef8ac93cd379dcd14a2ffbc86c1988
Reviewed-by: Christian Kandeler <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
F_GETFD is both cheaper and easier to port, and otherwise has the same
effect here.
Change-Id: I62ebfc74855b8d8a938476394c269c17a8be98cc
Reviewed-by: Christian Kandeler <[email protected]>
|
| |/
|
|
|
|
|
|
|
|
|
| |
__attribute__ is a GNU extension. If we want to link against the
libraries using a different compiler, it needs to be disabled. It was
already disabled in libdw.h, and this patch extends this to the other
headers. We move the defines to libelf.h as that is included in all
the others.
Change-Id: I6e22674641f19f5a8820e2c7c7ec46f2fd70a8af
Reviewed-by: Christian Kandeler <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.
Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.
https://sourceware.org/bugzilla/show_bug.cgi?id=21199
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The maximum compression factor (http://www.zlib.net/zlib_tech.html) is
1032:1. Add a sanity check for that before trying to allocate lots of
memory and trying to decompress lots of bogus data.
https://sourceware.org/bugzilla/show_bug.cgi?id=21301
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
unsigned long int is not always capable to have pointer in some cases
(LLP64, for example). Return a void pointer instead. Other libelf
implementations will also make this change (or already have).
Also update the documentation to state what is created and that NULL
is returned on error (don't document that the returned value is a
pointer to the actual header created).
Signed-off-by: Akihiko Odaki <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Bad sh_off or sh_size could trigger a bad malloc or read. Sanity check
the header values first before trying to malloc a huge buffer or reading
any data that will certainly fail.
https://bugzilla.redhat.com/show_bug.cgi?id=1387584
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are various sanity checks that depend on knowing the file size
of the underlying ELF file which we only used when mmapping the ELF file.
Although we probably won't crash if we use pread to try to read from
the file, we still might return completely bogus data structures. This
could cause us to malloc insane amounts of memory.
Always try to get the maxsize when unknown in elf_begin.c (read_file).
https://bugzilla.redhat.com/show_bug.cgi?id=1388057
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
Define/open code memrchr, rawmemchr, powerof2 and TEMP_FAILURE_RETRY if
not available through system headers.
Signed-off-by: Akihiko Odaki <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The testcase added to run-strip-reloc.sh for strip-compressed.o showed
a memory leak when ran under valgrind (configure --enable-valgrind).
For a mmapped ELF file when existing section data was compressed
elf_end would fail to release the new compressed data buffer assigned
to rawdata_base. For non-mapped files rawdata_base is always freed.
For decompressed data rawdata_base is released together with zdata_base.
Use the Elf_Scn flag ELF_T_MALLOCED to track whether rawdata_base
points to malloced memory and free it in elf_end even for mmapped
ELF files.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
Nobody has hacked on eu-ld in a very long time. It didn't really work.
And we didn't install it by default in the spec file. Remove sources,
the build rules and any (now) unused code.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
elf[32|64]_updatenull would sanity check the e_type before allowing to
update the phdrs. This prevents creating an ET_REL file with phdrs. It
also prevents creating any vendor specific ELF file having phdrs. We
only check this when updating/writing out the file. But we would just
read such files. Don't prevent people from creating unexpected ELF files.
elflint will warn for such files.
While writing a new testcase for this another bug was found that
prevented updating a just created phdr because elf_getphdrnum would
sanity check the phdr offset in the file (which doesn't exist yet).
Fix that by only doing such a sanity check if the phdrs haven't been
read in or created yet.
This second bug should have been found by the existing elfshphehdr
test, but that test contained a typo checking elf_getphdrnum.
It tested that the called failed when there were no phdrs, but then
elf_getphdrnum should simply succeed and return zero.
https://bugzilla.redhat.com/show_bug.cgi?id=1352232
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When getting section headers it is assumed that the first section
is on the first section list. However, it is possible that the
first section list only contains the zeroth section, in which
case either illegal memory access occurs or elf_nextscn()
erroneously returns NULL.
With this patch, checks are added to avoid the illegal memory
access and (if available) the second section list is looked at
to find the first section.
A new test emptyfile is added that tests adding a section to
and "empty" ELF file 32/64 class with ELF_C_RDWR[_MMAP].
Signed-off-by: John Ogness <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Add lots of new EM_* definitions.
Add R_BPF_* definitions.
Signed-off-by: Richard Henderson <[email protected]>
|
| |
|
|
|
|
| |
On error we return NULL, not out_buf. So make sure to not leak it.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
| |
We forgot to free scns when returning ELF_E_NOMEM.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Update elf.h from glibc and recognize R_386_GOT32X, R_X86_64_GOTPCRELX
and R_x86_64_REX_GOTPCRELX as non-dynamic relocations.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Linux kernel 3.18 added the NT_ARM_SYSTEM_CALL regset for aarch64.
Recognize and print this new core item.
https://bugzilla.redhat.com/show_bug.cgi?id=1285613
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In commit c0748e "libelf: More checking of valid sh_addralign values." we
adjusted bogus alignment of data buffers if they were greater than the
offset of the data in the file. This works OK, except when there is no
data in the file. So make sure to not adjust any NOBITS sections.
Also adds a test that shows the issue and makes sure elflint is called
with --gnu in run-strip-test.sh.
https://bugzilla.redhat.com/show_bug.cgi?id=1303845
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
* elf_compress.c (__libelf_compress): do_deflate_cleanup
* elf_strptr.c (elf_strptr): get_zdata
Signed-off-by: Chih-Hung Hsieh <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Older glibc elf.h might not define the new ELF compression defines and
types. If not just define them in libelf.h directly to make the libelf
headers work on older glibc systems.
Also include a testcase to check the libelf headers build against the
system elf.h.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810885
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
elf_strptr indexes into the section data. This is defined as index into
the uncompressed data of the section. If the section is compressed make
sure the uncompressed data is available, but don't really decompress the
section header (elf_getdata will still return compressed data).
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Elf_Data of a compressed section has type ELF_T_CHDR. This type can be
xlated to the file or memory representation. This will make sure the Chdr
is in the correct endianess. The compressed data following the Chdr isn't
translated.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
| |
Explicitly link libelf and libdw with -lz.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Jose E. Marchesi <[email protected]>
|