| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
Exit status of 255 in case of an error is probably not what elfcompress
users expect, change it to 1.
Reported-by: Vitaly Chikunov <vt@altlinux.org>
Fixes: 92acb57eb046 ("elfcompress: New utility.")
|
|
|
|
|
|
|
|
|
| |
At the point of "Nothing to do" fnew variable has not been assigned
after initialization, so it does not have to be reset to NULL.
Note that any reset of fnew to NULL has to preceded with free(fnew).
Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
|
|
|
|
|
|
|
|
|
| |
When elfcompress decides that no section data needs to be updated and
therefore the file does not have to be rewritten, it still has to exit
with a zero status indicating success.
Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856
Fixes: c497478390de ("elfcompress: Replace cleanup() with label")
|
|
|
|
|
|
|
| |
New function in system.h that returns true if a string has a given
prefix, false otherwise. Use it in place of strncmp.
Signed-off-by: Martin Liška <mliska@suse.cz>
|
|
|
|
|
|
|
| |
If dwfl_begin fails we won't use the dwfl_fd descriptor we just dupped.
Make sure to close on dwfl_begin failure to avoid the leak.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
eu-unstrip might leak a string for each module found when using the -d
option. Make sure to free the output_file name when we are done with the
module.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
newfd is normally created by mkstemp given the original fd exists.
Otherwise it will created by open from arfname. In the second case
newfd might not get closed. Preventd this by always trying to close
it after errout.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
| |
We are going through vna_next, vn_next and vd_next in a while loop.
Make sure that all offsets are sane. We don't want things to wrap
around so we go in cycles.
https://sourceware.org/bugzilla/show_bug.cgi?id=27501
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
| |
This unifies the error handling with the rest of the code base and gets
rid of a nested function.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
| |
This is a simple one-liner, so inline this into the few callers.
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of an unnecessary nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
And rename it to buffer_left() to be a bit more descriptive
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
| |
Rename it to buffer_pos() to be a bit more descriptive and get rid of a
nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
|
|
| |
While inspecting some type units I noticed the type offset seemed off.
We were printing the offset as is, but it should include the offset of
the unit. There was actually a testcase for this, run-readelf-types.sh
but that had the same bug in the expected output. Fixed both.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
For DWARF version 4 or higher a block form really encodes a block,
not an expression location. Also constant offsets can be expressed
as DW_FORM_implicit_const in DWARF version 5.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
advance_pc() uses show_op_index to save whether the current op_index is
> 0 OR the new op_index is > 0.
The new op index is calculated via
new_op_index = (op_index + op_advance) % max_ops_per_instr;
since all of the variables involved are unsigned,
new_op_index >= op_index is always true.
So...
if op_index > 0, then new_op_index > 0
if op_index == 0, then new_op_index >= 0
and if the new_op_index is > 0, then the old one was as well.
In any case, we only need to check the new_op_index, since show_op_index
used to OR the two comparisons.
In other words:
op_index > 0 | new_op_index > 0 || show_op_index
------------------------------------------------
true true true
false true true
true false true xx
false false false
... but since the third line (marked with xx) is not possible,
the table becomes:
op_index > 0 | new_op_index > 0 || show_op_index
------------------------------------------------
true true true
false true true
false false false
... and show_op_index is equal to (new_op_index > 0).
So, remove the show_op_index variable and simply replace it by comparing
the new op_index > 0.
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of the nested functions
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The no_symtab_updates() function was being called at the beginning of
all case labels in this switch, so we can just call it once before the
switch. Then it only has one call-site, so inline this short function
there.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
| |
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
|
| |
Pull relocate() info file scope and get rid of a nested function this
way. Refactor remove_debug_relocations() to minimize the parameters we
need to pass to relocate().
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
| |
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
SHF_GNU_RETAIN is like SHF_LINK_ORDER it can appear on any section
and should be ignored by elflint. Add all such flags to a new
EXTRA_SHFLAGS and use it consistently in check_sections.
https://sourceware.org/bugzilla/show_bug.cgi?id=27134
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
before the change section_flags_string() ignored unknown section
flags: snprintf() did write numeric value into buffer, but
"*cp = '\0'" negated the effect.
The change advances the 'cp' pointer'.
While at it add a '|' separator between known and unknown flags.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
This program is single threaded, so using qsort with a global variable
isn't a danger. The interface for qsort_r isn't standardized (and
diverges between glibc and FreeBSD, for example), which makes usage of
qsort, where possible, preferrable.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
readelf -S now shows 'R' when SHF_GNU_RETAIN is set.
elflint accepts SHF_GNU_RETAIN when set on section in --gnu mode.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
Make use of the _(Str) macro provided by <config.h>.
The change was made automatically using the following command:
$ git grep -l '\<gettext *(' src |xargs sed -i 's/\<gettext *(/_(/g'
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the definition of _(Str) macro to lib/eu-config.h which already
provides a definition of N_(Str) macro. Since lib/eu-config.h is
appended to config.h, it is included into every compilation unit
and therefore both macros are now universally available.
Remove all other definitions of N_(Str) and _(Str) macros from other files
to avoid conflicts and redundancies.
The next step is to replace all uses of gettext(Str) with _(Str).
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding the symbol name associated with the symbol index number
makes the error messages a little bit more useful. We used to say:
section [59] '.symtab': symbol 9: st_value out of bounds
But now says:
section [59] '.symtab': symbol 9 (.annobin_size.c.hot): st_value out of bounds
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Indeces -> Indices
adress -> address
affort -> afford
dont' -> don't
futher -> further
higest -> highest
indeces -> indices
interate -> iterate
occured -> occurred
overlow -> overflow
sectin -> section
succesful -> successful
teminated -> terminated
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since all these help text strings are marked for translation, apply the fixes
to translation strings as well, this helps to avoid translations becoming fuzzy.
lenght -> length
occured -> occurred
endianess -> endianness
reversable -> reversible
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Use defined constants for permission values. Also add fallback
definitions for them in system.h, to allow for compatibility with
systems that don't provide these macros.
Include system.h in all tests/ files that required it.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
- Make configure.ac test for fts and obstack availability;
- Add fts and obstack ldflags to all files that need them;
- Add missing argp ldflags to programs in debuginfod/.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This functon has inherent safety issues, since a long enough path can
lead to memory clobbering. Due to the recursive nature of
make_directories(), multiple calls could also stack overflow. Instead,
the string can be allocated in the heap.
As a bonus, this improves musl compatibility, since musl doesn't include
the strndupa macro for now.
Also add braces around while loop.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
|
|
|
|
|
|
|
|
|
| |
View pairs are encoded in .debug_loclists as they are encoded in
.debug_locs sections by the GCC compiler. Scan for DW_AT_GNU_locviews
attributes that point to the view pairs just in front of the actual
location lists.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DW_CFA_AARCH64_negate_ra_state is used on aarch64 to indicate whether
or not the return address is mangled or not. This has the same value
as the DW_CFA_GNU_window_save. So we have to pass around the e_machine
value of the process or core we are inspecting to know which one to
use.
Note that it isn't actually implemented yet. It needs ARMv8.3 hardware.
If we don't have such hardware it is enough to simply ignore the
DW_CFA_AARCH64_negate_ra_state (and not confuse it with
DW_CFA_GNU_window_save) to get backtraces to work on aarch64.
Add a testcase for eu-readelf --debug-dump=frames to show the value
is correctly recognized. Also don't warn we cannot find any DWARF
if we are just dumping frames (those will come from .eh_frame if
there is no .debug_frame).
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
In both debug_ranges and debug_loc a base address entry can be the
first in the range or loc list. If so print the offset and set first
to false. Otherwise don't print the entry list offset, but do set
first to false.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|