| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
Nobody can use those, and as windows doesn't have proper symlinks, they
take up lots of space.
Change-Id: If62db984c7ac62e798a88e3a4ecd15962683d001
Reviewed-by: Christian Kandeler <[email protected]>
|
| |\
| |
| |
| |
| |
| | |
elfutils 0.173 release
Change-Id: I83dc56dd15c26fe7acf4ce73c29df65b8b65e757
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For i386 and x86_64 we allow some unaligned data accesses.
We also return unaligned data from elf_getdata[_rawchunk].
But that might go wrong if we then access the ELF types inside.
When build with gcc -O3 for example the compiler might vectorize
loops accessing ELF words or types. The instructions used do require
the data is naturally aligned. If the function returnes unaligned
data the program will segfault and crash. This happens for example
with the code in dwfl_module_getdwarf.c that tries to iterate over
the hash buckets gotten through elf_getdata_rawchunk based on the
DT_[GNU]_HASH value.
This only happens when the underlying ELF file is mmapped, and it
is meant as optimization so that we don't have to copy data first
so that it is correctly aligned. In most cases the data is already
naturally aligned though. But it might not be for non-native ELF
files.
Given that it might even happen in our own code base and these
are public functions that can be used by code that might rely on
the data returned being correctly aligned for the ELF data type
requested just always return correctly aligned data.
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| | |
Add NT_PPC_PKEY, R_BPF_64_64 and R_BPF_64_32. Remove R_BPF_MAP_FD.
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| | |
Signed-off-by: Andreas Schwab <[email protected]>
|
| | |
| |
| |
| | |
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
We won't use the e_shoff value in that case because we will set
elf->state.elf[64|32].scns.cnt to zero to indicate not to read
any section header data from the file.
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Add ELF_E_INVALID_ELF which is set when the ELF file data is bad.
This is different from ELF_E_INVALID_FILE which is set when the file
could not be read.
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If so, define attribute_hidden to be empty. Also, use attribute_hidden
in all places where we hide symbols. If this attribute is missing, it
simply means that we cannot hide private symbols in the binary using
attributes. This disables some optimizations and may increase the risk
of symbol name clashes with other libraries, but is not fatal.
However, we still employ linker version scripts to explicitly define
the exported symbols. This serves much of the same purpose. Also, as
all our symbols are prefixed with the library name, and "__" for
private ones, the chance of clashes is low anyway.
Signed-off-by: Ulf Hermann <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 <[email protected]>
|
| | |
| |
| |
| |
| |
| | |
Add new powerpc note descriptors.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |\|
| |
| |
| |
| |
| | |
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]>
|