[PATCH] Avoid a shadowing declaration warning with GCC 4.4
by Jose E. Marchesi
Hi. This little patch fixes two warnings raised by GCC 4.4.7:
declaration of ‘check’ shadows a global declaration
commit 885b420ec0973467d7fc3d5719a1d5cda789cf59
Author: Jose E. Marchesi <jose.marchesi(a)oracle.com>
Date: Fri Oct 9 06:50:30 2015 -0400
Avoid a shadowing declaration warning with GCC 4.4.
Signed-off-by: Jose E. Marchesi <jose.marchesi(a)oracle.com>
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 66781d0..ae1e9df 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-09 Jose E. Marchesi <jose.marchesi(a)oracle.com>
+
+ * elfshphehdr.c (check): Argument `check' renamed to `check_p' to
+ avoid a warning in GCC 4.4.x.
+ (check_elf): Likewise.
+
2015-10-05 Josh Stone <jistone(a)redhat.com>
* Makefile.am (backtrace-child-biarch): Add AM_V_CC silencer.
diff --git a/tests/elfshphehdr.c b/tests/elfshphehdr.c
index 5f6b96c..16232fe 100644
--- a/tests/elfshphehdr.c
+++ b/tests/elfshphehdr.c
@@ -31,9 +31,9 @@
#include <stdbool.h>
void
-check (const char *msg, bool check)
+check (const char *msg, bool check_p)
{
- if (! check)
+ if (! check_p)
{
fprintf (stderr, "%s FAILED\n", msg);
exit (-1);
@@ -43,9 +43,9 @@ check (const char *msg, bool check)
}
void
-check_elf (const char *msg, bool check)
+check_elf (const char *msg, bool check_p)
{
- if (! check)
+ if (! check_p)
{
fprintf (stderr, "%s: %s\n", msg, elf_errmsg (-1));
exit (-1);
8 years, 6 months
[PATCH 0/5] A few sparc fixes
by Jose E. Marchesi
Hello. This small patch series fixes several issues in sparc-*-* and
sparc64-*-* targets.
Jose E. Marchesi (5):
Use -fPIC instead of -fpic when generating PIC code.
sparc: support for the check_object_attribute ebl hook.
sparc: add some missing relocation types.
sparc: fix the extraction of relocation IDs from r_type fields.
Use seek+read instead of pread to read from /dev/$$/mem files.
ChangeLog | 5 ++++
backends/ChangeLog | 19 ++++++++++++
backends/Makefile.am | 2 +-
backends/common-reloc.c | 15 +++++++++-
backends/sparc_attrs.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++
backends/sparc_init.c | 6 ++++
backends/sparc_reloc.def | 3 ++
config/ChangeLog | 5 ++++
config/eu.am | 4 +--
configure.ac | 2 +-
lib/ChangeLog | 5 ++++
lib/Makefile.am | 2 +-
libcpu/ChangeLog | 5 ++++
libcpu/Makefile.am | 2 +-
libdw/ChangeLog | 5 ++++
libdw/Makefile.am | 2 +-
libdwfl/ChangeLog | 5 ++++
libdwfl/linux-proc-maps.c | 14 +++++++--
libebl/ChangeLog | 5 ++++
libebl/Makefile.am | 2 +-
libelf/ChangeLog | 5 ++++
libelf/Makefile.am | 2 +-
22 files changed, 178 insertions(+), 12 deletions(-)
create mode 100644 backends/sparc_attrs.c
--
2.3.4
8 years, 6 months
[PATCH] Move recursive nested function to file scope.
by Chih-Hung Hsieh
Prepare to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
src/ChangeLog | 5 ++++
src/ld.c | 94 ++++++++++++++++++++++++++++++-----------------------------
2 files changed, 53 insertions(+), 46 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 238c416..981aaeb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-15 Chih-Hung Hsieh <chh(a)google.com>
+
+ * ld.c (determine_output_format): Move recurisve nested
+ function "try" to file scope.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
* readelf.c (print_debug_exception_table): Initialize variable before
diff --git a/src/ld.c b/src/ld.c
index 6e96ae2..b9a4f64 100644
--- a/src/ld.c
+++ b/src/ld.c
@@ -1049,6 +1049,53 @@ parse_B_option_2 (const char *arg)
}
+static inline int
+try (int fd, Elf *elf)
+{
+ int result = 0;
+
+ if (elf == NULL)
+ return 0;
+
+ if (elf_kind (elf) == ELF_K_ELF)
+ {
+ /* We have an ELF file. We now can find out
+ what the output format should be. */
+ XElf_Ehdr_vardef(ehdr);
+
+ /* Get the ELF header of the object. */
+ xelf_getehdr (elf, ehdr);
+ if (ehdr != NULL)
+ ld_state.ebl =
+ ebl_openbackend_machine (ehdr->e_machine);
+
+ result = 1;
+ }
+ else if (elf_kind (elf) == ELF_K_AR)
+ {
+ /* Try the archive members. This could
+ potentially lead to wrong results if the
+ archive contains files for more than one
+ architecture. But this is the user's
+ problem. */
+ Elf *subelf;
+ Elf_Cmd cmd = ELF_C_READ_MMAP;
+
+ while ((subelf = elf_begin (fd, cmd, elf)) != NULL)
+ {
+ cmd = elf_next (subelf);
+
+ if (try (fd, subelf) != 0)
+ break;
+ }
+ }
+
+ elf_end (elf);
+
+ return result;
+}
+
+
static void
determine_output_format (void)
{
@@ -1078,52 +1125,7 @@ determine_output_format (void)
int fd = open (runp->name, O_RDONLY);
if (fd != -1)
{
- int try (Elf *elf)
- {
- int result = 0;
-
- if (elf == NULL)
- return 0;
-
- if (elf_kind (elf) == ELF_K_ELF)
- {
- /* We have an ELF file. We now can find out
- what the output format should be. */
- XElf_Ehdr_vardef(ehdr);
-
- /* Get the ELF header of the object. */
- xelf_getehdr (elf, ehdr);
- if (ehdr != NULL)
- ld_state.ebl =
- ebl_openbackend_machine (ehdr->e_machine);
-
- result = 1;
- }
- else if (elf_kind (elf) == ELF_K_AR)
- {
- /* Try the archive members. This could
- potentially lead to wrong results if the
- archive contains files for more than one
- architecture. But this is the user's
- problem. */
- Elf *subelf;
- Elf_Cmd cmd = ELF_C_READ_MMAP;
-
- while ((subelf = elf_begin (fd, cmd, elf)) != NULL)
- {
- cmd = elf_next (subelf);
-
- if (try (subelf) != 0)
- break;
- }
- }
-
- elf_end (elf);
-
- return result;
- }
-
- if (try (elf_begin (fd, ELF_C_READ_MMAP, NULL)) != 0)
+ if (try (fd, elf_begin (fd, ELF_C_READ_MMAP, NULL)) != 0)
/* Found a file. */
break;
}
--
2.6.0.rc0.131.gf624c3d
8 years, 6 months
[COMMITTED] tests: Rename argument from check to statement in elfshphehdr.c.
by Mark Wielaard
Some older compilers warn about a function and argument name being equal.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
tests/ChangeLog | 5 +++++
tests/elfshphehdr.c | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 66781d0..523a350 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-09 Mark Wielaard <mjw(a)redhat.com>
+
+ * elfshphehdr.c (check): Rename argument from check to statement.
+ (check_elf): Likewise.
+
2015-10-05 Josh Stone <jistone(a)redhat.com>
* Makefile.am (backtrace-child-biarch): Add AM_V_CC silencer.
diff --git a/tests/elfshphehdr.c b/tests/elfshphehdr.c
index 5f6b96c..0d92934 100644
--- a/tests/elfshphehdr.c
+++ b/tests/elfshphehdr.c
@@ -31,9 +31,9 @@
#include <stdbool.h>
void
-check (const char *msg, bool check)
+check (const char *msg, bool statement)
{
- if (! check)
+ if (! statement)
{
fprintf (stderr, "%s FAILED\n", msg);
exit (-1);
@@ -43,9 +43,9 @@ check (const char *msg, bool check)
}
void
-check_elf (const char *msg, bool check)
+check_elf (const char *msg, bool statement)
{
- if (! check)
+ if (! statement)
{
fprintf (stderr, "%s: %s\n", msg, elf_errmsg (-1));
exit (-1);
--
1.8.3.1
8 years, 6 months
[PATCH] strip: Only sanity check symbols to not discarded sections for debug file.
by Mark Wielaard
We can only sanity check the symbols to discarded sections when creating a
debug file. Otherwise we won't keep track of debug_data. This can trigger
erroneously when there are relocation symbols in the symtab for a .debug
section but we are not putting those symbols in a separate .debug file.
Adjust run-strip-test.sh to always run in-place strip size check even
for ET_REL files. Before this fix the sanity check would trigger for
some ET_REL files because they contained such relocation symbols to
.debug sections (but debug_data would be NULL because -f wasn't used).
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
src/ChangeLog | 5 +++++
src/strip.c | 8 +++++---
tests/run-strip-test.sh | 16 +++++-----------
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 411c70b..7bd2a61 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-04 Mark Wielaard <mjw(a)redhat.com>
+
+ * strip.c (handle_elf): Only sanity check section symbols to not
+ kept discarded sections if we are creating a debug file.
+
2015-10-02 Mark Wielaard <mjw(a)redhat.com>
* unstrip.c (copy_elided_sections): Use SH_INFO_LINK_P, not just
diff --git a/src/strip.c b/src/strip.c
index 41169ed..6fdb3bf 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1379,9 +1379,11 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
shdr_info[cnt].shdr.sh_info = destidx - 1;
}
}
- else if (debug_fname == NULL
- || shdr_info[cnt].debug_data == NULL)
- /* This is a section or group signature symbol
+ else if (debug_fname != NULL
+ && shdr_info[cnt].debug_data == NULL)
+ /* The symbol points to a section that is discarded
+ but isn't preserved in the debug file. Check that
+ this is a section or group signature symbol
for a section which has been removed. */
{
size_t sidx = (sym->st_shndx != SHN_XINDEX
diff --git a/tests/run-strip-test.sh b/tests/run-strip-test.sh
index 2ebb5a9..43d27e5 100755
--- a/tests/run-strip-test.sh
+++ b/tests/run-strip-test.sh
@@ -50,17 +50,11 @@ testrun ${abs_top_builddir}/src/elfcmp --hash-inexact $original testfile.unstrip
}
# Now strip in-place and make sure it is smaller.
-# Skip ET_REL files, they might have unexpected symbol table entries.
-is_ET_REL=0
-testrun ${abs_top_builddir}/src/readelf -h $original 2>&1 \
- | fgrep 'REL (Relocatable file)' && is_ET_REL=1
-if test $is_ET_REL -eq 0; then
- SIZE_original=$(stat -c%s $original)
- testrun ${abs_top_builddir}/src/strip $original
- SIZE_stripped=$(stat -c%s $original)
- test $SIZE_stripped -lt $SIZE_original ||
- { echo "*** failure in-place strip file not smaller $original"; status=1; }
-fi
+SIZE_original=$(stat -c%s $original)
+testrun ${abs_top_builddir}/src/strip $original
+SIZE_stripped=$(stat -c%s $original)
+test $SIZE_stripped -lt $SIZE_original ||
+ { echo "*** failure in-place strip file not smaller $original"; status=1; }
tempfiles testfile.sections
testrun ${abs_top_builddir}/src/readelf -S testfile.temp > testfile.sections || status=$?
--
2.4.3
8 years, 6 months
[PATCH] unstrip: Update sh_info when SH_INFO_LINK_P, not just when SHF_INFO_LINK set.
by Mark Wielaard
SHF_INFO_LINK is not consistently set when sh_info is actually a section
index reference. Use SH_INFO_LINK_P to check whether to update the sh_info
value. SH_INFO_LINK_P also checks the section type to know whether or not
sh_info is meant to as section index.
Found by run-strip-strmerge.sh test with older binutils.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
src/ChangeLog | 5 +++++
src/unstrip.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 72bb0ab..411c70b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2015-10-02 Mark Wielaard <mjw(a)redhat.com>
+ * unstrip.c (copy_elided_sections): Use SH_INFO_LINK_P, not just
+ SHF_INFO_LINK.
+
+2015-10-02 Mark Wielaard <mjw(a)redhat.com>
+
* strip.c (handle_elf): Don't move around allocated NOBITS sections.
Don't just mark the section header string table as unused.
* unstrip.c (copy_elided_sections): Add header names to strtab if
diff --git a/src/unstrip.c b/src/unstrip.c
index d40df97..d193708 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1526,7 +1526,7 @@ more sections in stripped file than debug file -- arguments reversed?"));
if (sec->shdr.sh_link != SHN_UNDEF)
shdr_mem.sh_link = ndx_section[sec->shdr.sh_link - 1];
- if (shdr_mem.sh_flags & SHF_INFO_LINK)
+ if (SH_INFO_LINK_P (&sec->shdr) && sec->shdr.sh_info != 0)
shdr_mem.sh_info = ndx_section[sec->shdr.sh_info - 1];
if (strtab != NULL)
--
1.8.3.1
8 years, 6 months
[PATCH] Handle merged strtab/shstrtab string tables in strip and unstrip.
by Mark Wielaard
ELF files can share the section header string table (e_shstrndx) with
the symtab .strtab section. That might in some cases save a bit of space
since symbols and sections might share some (sub)strings. To handle that
eu-strip just needs to not unconditionally remove the .shstrtab section
(it will be properly marked as used/unused as needed). eu-unstrip needs
to make sure the section names are added to the strtab if it decides to
rewrite that section. Also makes sure that eu-strip won't move around
a SHT_NOBITS section that has SHF_ALLOC set. Although it is allowed to
move such sections around, there is no benefit. And some tools might
expect no allocated section to move around, not even a nobits section.
It also makes it harder to do "roundtripping" sanity checks that make
sure splitting a file with eu-strip and then reconstructed with eu-unstrip
produce the same ELF file (as is done in the new run-strip-strmerge.sh).
Introduces a somewhat large test generator elfstrmerge.c that will
hopefully turn into a more generic string table merger program.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
src/ChangeLog | 7 +
src/strip.c | 15 +-
src/unstrip.c | 45 ++-
tests/ChangeLog | 8 +
tests/Makefile.am | 7 +-
tests/elfstrmerge.c | 662 ++++++++++++++++++++++++++++++++++++++++++++
tests/run-strip-strmerge.sh | 79 ++++++
7 files changed, 813 insertions(+), 10 deletions(-)
create mode 100644 tests/elfstrmerge.c
create mode 100755 tests/run-strip-strmerge.sh
diff --git a/src/ChangeLog b/src/ChangeLog
index 49aa3f7..72bb0ab 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-02 Mark Wielaard <mjw(a)redhat.com>
+
+ * strip.c (handle_elf): Don't move around allocated NOBITS sections.
+ Don't just mark the section header string table as unused.
+ * unstrip.c (copy_elided_sections): Add header names to strtab if
+ shstrndx equals the symtab strtabndx.
+
2015-09-22 Mark Wielaard <mjw(a)redhat.com>
* strip.c (cleanup_debug): Remove old-style function definitions.
diff --git a/src/strip.c b/src/strip.c
index 8b08d72..41169ed 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -644,10 +644,12 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
goto illformed;
/* Sections in files other than relocatable object files which
- don't contain any file content or are not loaded can be freely
- moved by us. In relocatable object files everything can be moved. */
+ not loaded can be freely moved by us. In theory we can also
+ freely move around allocated nobits sections. But we don't
+ to keep the layout of all allocated sections as similar as
+ possible to the original file. In relocatable object files
+ everything can be moved. */
if (ehdr->e_type == ET_REL
- || shdr_info[cnt].shdr.sh_type == SHT_NOBITS
|| (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
shdr_info[cnt].shdr.sh_offset = 0;
@@ -1035,9 +1037,10 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
}
}
- /* Mark the section header string table as unused, we will create
- a new one. */
- shdr_info[shstrndx].idx = 0;
+ /* Although we always create a new section header string table we
+ don't explicitly mark the existing one as unused. It can still
+ be used through a symbol table section we are keeping. If not it
+ will already be marked as unused. */
/* We need a string table for the section headers. */
shst = ebl_strtabinit (true);
diff --git a/src/unstrip.c b/src/unstrip.c
index 82bcdd8..d40df97 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1,5 +1,5 @@
/* Combine stripped files with separate symbols and debug information.
- Copyright (C) 2007-2012, 2014 Red Hat, Inc.
+ Copyright (C) 2007-2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Roland McGrath <roland(a)redhat.com>, 2007.
@@ -1709,9 +1709,52 @@ more sections in stripped file than debug file -- arguments reversed?"));
symstrdata = elf_getdata (unstripped_strtab, NULL);
Elf_Data *shndxdata = NULL; /* XXX */
+ /* If symtab and the section header table share the string table
+ add the section names to the strtab and then (after finalizing)
+ fixup the section header sh_names. Also dispose of the old data. */
+ struct Ebl_Strent *unstripped_strent[unstripped_shnum - 1];
+ if (unstripped_shstrndx == elf_ndxscn (unstripped_strtab))
+ {
+ for (size_t i = 0; i < unstripped_shnum - 1; ++i)
+ {
+ Elf_Scn *sec = elf_getscn (unstripped, i + 1);
+ GElf_Shdr mem;
+ GElf_Shdr *hdr = gelf_getshdr (sec, &mem);
+ const char *name = get_section_name (i + 1, hdr, shstrtab);
+ unstripped_strent[i + 1] = ebl_strtabadd (symstrtab, name, 0);
+ ELF_CHECK (unstripped_strent[i + 1] != NULL,
+ _("cannot add section name to string table: %s"));
+ }
+
+ if (strtab != NULL)
+ {
+ ebl_strtabfree (strtab);
+ free (strtab_data->d_buf);
+ strtab = NULL;
+ }
+ }
+
ebl_strtabfinalize (symstrtab, symstrdata);
elf_flagdata (symstrdata, ELF_C_SET, ELF_F_DIRTY);
+ /* And update the section header names if necessary. */
+ if (unstripped_shstrndx == elf_ndxscn (unstripped_strtab))
+ {
+ for (size_t i = 0; i < unstripped_shnum - 1; ++i)
+ {
+ Elf_Scn *sec = elf_getscn (unstripped, i + 1);
+ GElf_Shdr mem;
+ GElf_Shdr *hdr = gelf_getshdr (sec, &mem);
+ shdr->sh_name = ebl_strtaboffset (unstripped_strent[i + 1]);
+ update_shdr (sec, hdr);
+ }
+ }
+
+ /* Now update the symtab shdr. Reload symtab shdr because sh_name
+ might have changed above. */
+ shdr = gelf_getshdr (unstripped_symtab, &shdr_mem);
+ ELF_CHECK (shdr != NULL, _("cannot get section header: %s"));
+
shdr->sh_size = symdata->d_size = (1 + nsym) * shdr->sh_entsize;
symdata->d_buf = xmalloc (symdata->d_size);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0f8925e..9d07912 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2015-10-02 Mark Wielaard <mjw(a)redhat.com>
+
+ * elfstrmerge.c: New check program.
+ * run-strip-strmerge.sh: New test.
+ * Makefile.am (check_PROGRAMS): Add elfstrmerge.
+ (EXTRA_DIST): Add run-strip-strmerge.sh
+ (elfstrmerge_LDADD): New variable.
+
2015-09-29 Mark Wielaard <mjw(a)redhat.com>
* elfshphehdr.c: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index eaa904c..4ff48e6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -52,7 +52,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
backtrace-data backtrace-dwarf debuglink debugaltlink \
buildid deleted deleted-lib.so aggregate_size vdsosyms \
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
- elfshphehdr
+ elfshphehdr elfstrmerge
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -78,7 +78,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \
run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \
run-strip-test9.sh run-strip-test10.sh \
- run-strip-groups.sh run-strip-reloc.sh \
+ run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \
run-unstrip-test.sh run-unstrip-test2.sh \
run-unstrip-test3.sh run-unstrip-M.sh \
run-ecp-test.sh run-ecp-test2.sh run-alldts.sh \
@@ -161,7 +161,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-line2addr.sh run-elflint-test.sh testfile14.bz2 \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \
- run-strip-test9.sh run-strip-test10.sh \
+ run-strip-test9.sh run-strip-test10.sh run-strip-strmerge.sh \
run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \
hello_ppc64.ko.bz2 hello_s390.ko.bz2 hello_aarch64.ko.bz2 \
run-unstrip-test.sh run-unstrip-test2.sh \
@@ -451,6 +451,7 @@ elfstrtab_LDADD = $(libelf)
dwfl_proc_attach_LDADD = $(libdw)
dwfl_proc_attach_LDFLAGS = -pthread
elfshphehdr_LDADD =$(libelf)
+elfstrmerge_LDADD = $(libebl) $(libelf)
if GCOV
check: check-am coverage
diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c
new file mode 100644
index 0000000..5cd93f8
--- /dev/null
+++ b/tests/elfstrmerge.c
@@ -0,0 +1,662 @@
+/* Merge string sections.
+ Copyright (C) 2015 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <error.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <unistd.h>
+
+#include <gelf.h>
+#include ELFUTILS_HEADER(ebl)
+
+/* The original ELF file. */
+static int fd = -1;
+static Elf *elf = NULL;
+static bool replace;
+
+/* The new ELF file. */
+static char *fnew = NULL;
+static int fdnew = -1;
+static Elf *elfnew = NULL;
+
+/* The merged string table. */
+static struct Ebl_Strtab *strings = NULL;
+
+/* Section name strents. */
+static struct Ebl_Strent **scnstrents = NULL;
+
+/* Symbol name strends. */
+static struct Ebl_Strent **symstrents = NULL;
+
+/* New ELF file buffers. */
+static Elf_Data newstrtabdata = { .d_buf = NULL };
+static size_t newshnums = 0;
+static void **newscnbufs = NULL;
+
+/* Release all files and resources allocated. */
+static void
+release (void)
+{
+ /* The new string table. */
+ if (strings != NULL)
+ ebl_strtabfree (strings);
+
+ free (scnstrents);
+ free (symstrents);
+ free (newstrtabdata.d_buf);
+
+ /* Any new data buffers allocated. */
+ for (size_t i = 0; i < newshnums; i++)
+ free (newscnbufs[i]);
+ free (newscnbufs);
+
+ /* The new ELF file. */
+ if (fdnew != -1)
+ {
+ unlink (fnew);
+ elf_end (elfnew);
+ close (fdnew);
+ }
+ // Don't release, we might need it in the error message.
+ // if (replace)
+ // free (fnew);
+
+ /* The original ELF file. */
+ elf_end (elf);
+ close (fd);
+}
+
+/* The various ways we can fail... Cleanup and show some message to
+ the user. The file name may be NULL. */
+static void __attribute__ ((noreturn))
+fail (const char *msg, const char *fname)
+{
+ release ();
+ if (fname != NULL)
+ error (1, 0, "%s: %s", fname, msg);
+ else
+ error (1, 0, "%s", msg);
+ abort();
+}
+
+static void __attribute__ ((noreturn))
+fail_errno (const char *msg, const char *fname)
+{
+ release ();
+ if (fname != NULL)
+ error (1, errno, "%s: %s", fname, msg);
+ else
+ error (1, errno, "%s", msg);
+ abort();
+}
+
+static void __attribute__ ((noreturn))
+fail_idx (const char *msg, const char *fname, size_t idx)
+{
+ release ();
+ if (fname != NULL)
+ error (1, 0, "%s: %s %zd", fname, msg, idx);
+ else
+ error (1, 0, "%s %zd", msg, idx);
+ abort();
+}
+
+static void __attribute__ ((noreturn))
+fail_elf (const char *msg, const char *fname)
+{
+ release ();
+ if (fname != NULL)
+ error (1, 0, "%s: %s: %s", fname, msg, elf_errmsg (-1));
+ else
+ error (1, 0, "%s: %s", msg, elf_errmsg (-1));
+ abort();
+}
+
+static void __attribute__ ((noreturn))
+fail_elf_idx (const char *msg, const char *fname, size_t idx)
+{
+ release ();
+ if (fname != NULL)
+ error (1, 0, "%s: %s %zd: %s", fname, msg, idx, elf_errmsg (-1));
+ else
+ error (1, 0, "%s %zd: %s", msg, idx, elf_errmsg (-1));
+ abort();
+}
+
+int
+main (int argc, char **argv)
+{
+ elf_version (EV_CURRENT);
+
+ /* Basic command line handling. Need to replace the input file? */
+ if ((argc != 2 && argc != 4)
+ || (argc == 4 && strcmp (argv[1], "-o") != 0))
+ fail ("Usage argument: [-o <outputfile>] <inputfile>", NULL);
+ replace = argc == 2;
+
+ /* Get the ELF file. */
+ const char *fname;
+ if (replace)
+ fname = argv[1];
+ else
+ fname = argv[3];
+ fd = open (fname, O_RDONLY);
+ if (fd < 0)
+ fail_errno ("couldn't open", fname);
+
+ elf = elf_begin (fd, ELF_C_READ, NULL);
+ if (elf == NULL)
+ fail_elf ("couldn't open ELF file for reading", fname);
+
+ GElf_Ehdr ehdr;
+ if (gelf_getehdr (elf, &ehdr) == NULL)
+ fail_elf ("Couldn't get ehdr", fname);
+
+ /* Get the section header string table. */
+ size_t shdrstrndx;
+ if (elf_getshdrstrndx (elf, &shdrstrndx) != 0)
+ fail_elf ("couldn't get section header string table index", fname);
+
+ Elf_Scn *shdrstrscn = elf_getscn (elf, shdrstrndx);
+ GElf_Shdr shdrstrshdr_mem;
+ GElf_Shdr *shdrstrshdr = gelf_getshdr (shdrstrscn, &shdrstrshdr_mem);
+ if (shdrstrshdr == NULL)
+ fail_elf ("couldn't get section header string table section", fname);
+
+ if ((shdrstrshdr->sh_flags & SHF_ALLOC) != 0)
+ fail ("section header string table is an allocated section", fname);
+
+ /* Get the symtab section. */
+ size_t symtabndx = 0;
+ Elf_Scn *symtabscn = NULL;
+ GElf_Shdr symtabshdr_mem;
+ GElf_Shdr *symtabshdr;
+ while ((symtabscn = elf_nextscn (elf, symtabscn)) != NULL)
+ {
+ symtabshdr = gelf_getshdr (symtabscn, &symtabshdr_mem);
+ if (symtabshdr == NULL)
+ fail_elf ("couldn't get shdr", fname);
+
+ if (symtabshdr->sh_type == SHT_SYMTAB)
+ {
+ /* Just pick the first, we don't expect more than one. */
+ symtabndx = elf_ndxscn (symtabscn);
+ break;
+ }
+ }
+
+ if (symtabndx == 0)
+ fail ("No symtab found", fname);
+
+ if ((symtabshdr->sh_flags & SHF_ALLOC) != 0)
+ fail ("symtab is an allocated section", fname);
+
+ /* Get the strtab of the symtab. */
+ size_t strtabndx = symtabshdr->sh_link;
+ Elf_Scn *strtabscn = elf_getscn (elf, strtabndx);
+ GElf_Shdr strtabshdr_mem;
+ GElf_Shdr *strtabshdr = gelf_getshdr (strtabscn, &strtabshdr_mem);
+ if (strtabshdr == NULL)
+ fail_elf ("Couldn't get strtab section", fname);
+
+ if (shdrstrndx == strtabndx)
+ {
+ error (0, 0, "%s: Nothing to do, shstrtab == strtab\n", fname);
+ release ();
+ return 0;
+ }
+
+ if ((strtabshdr->sh_flags & SHF_ALLOC) != 0)
+ fail ("strtab is an allocated section", fname);
+
+ size_t phnum;
+ if (elf_getphdrnum (elf, &phnum) != 0)
+ fail_elf ("Couldn't get number of phdrs", fname);
+
+ /* If there are phdrs we want to maintain the layout of the
+ allocated sections in the file. */
+ bool layout = phnum != 0;
+
+ /* Create a new merged strings table that starts with the empty string. */
+ strings = ebl_strtabinit (true);
+ if (strings == NULL)
+ fail ("No memory to create merged string table", NULL);
+
+ /* Add the strings from all the sections. */
+ size_t shdrnum;
+ if (elf_getshdrnum (elf, &shdrnum) != 0)
+ fail_elf ("Couldn't get number of sections", fname);
+ scnstrents = malloc (shdrnum * sizeof (struct Ebl_Strent *));
+ if (scnstrents == NULL)
+ fail ("couldn't allocate memory for section strings", NULL);
+
+ /* While going through all sections keep track of last allocated
+ offset if needed to keep the layout. We'll put any unallocated
+ sections behind those (strtab is unallocated and will change
+ size). */
+ GElf_Off last_offset = 0;
+ if (layout)
+ last_offset = (ehdr.e_phoff
+ + gelf_fsize (elf, ELF_T_PHDR, phnum, EV_CURRENT));
+ Elf_Scn *scn = NULL;
+ size_t scnnum = 1;
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+ fail_elf_idx ("couldn't get shdr", fname, scnnum);
+ /* Don't add the .shstrtab section itself, we'll not use it. */
+ if (shdr->sh_name != 0 && scnnum != shdrstrndx)
+ {
+ const char *sname = elf_strptr (elf, shdrstrndx, shdr->sh_name);
+ if (sname == NULL)
+ fail_elf_idx ("couldn't get section name", fname, scnnum);
+ if ((scnstrents[scnnum] = ebl_strtabadd (strings, sname, 0)) == NULL)
+ fail ("No memory to add to merged string table", NULL);
+ }
+
+ if (layout)
+ if (shdr->sh_type != SHT_NOBITS && (shdr->sh_flags & SHF_ALLOC) != 0)
+ if (last_offset < shdr->sh_offset + shdr->sh_size)
+ last_offset = shdr->sh_offset + shdr->sh_size;
+ scnnum++;
+ }
+
+ /* Add the strings from all the symbols. */
+ size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, EV_CURRENT);
+ Elf_Data *symd = elf_getdata (symtabscn, NULL);
+ if (symd == NULL)
+ fail_elf ("couldn't get symtab data", fname);
+ size_t symsnum = symd->d_size / elsize;
+ symstrents = malloc (symsnum * sizeof (struct Ebl_Strent *));
+ if (symstrents == NULL)
+ fail_errno ("Couldn't allocate memory for symbol strings", NULL);
+ for (size_t i = 0; i < symsnum; i++)
+ {
+ GElf_Sym sym_mem;
+ GElf_Sym *sym = gelf_getsym (symd, i, &sym_mem);
+ if (sym == NULL)
+ fail_elf_idx ("Couldn't get symbol", fname, i);
+ if (sym->st_name != 0)
+ {
+ const char *sname = elf_strptr (elf, strtabndx, sym->st_name);
+ if (sname == NULL)
+ fail_elf_idx ("Couldn't get symbol name", fname, i);
+ if ((symstrents[i] = ebl_strtabadd (strings, sname, 0)) == NULL)
+ fail_idx ("No memory to add to merged string table symbol",
+ fname, i);
+ }
+ }
+
+ /* We got all strings, build the new string table and store it as
+ new strtab. */
+ ebl_strtabfinalize (strings, &newstrtabdata);
+
+ /* We share at least the empty string so the result is at least 1
+ byte smaller. */
+ if (newstrtabdata.d_size >= shdrstrshdr->sh_size + strtabshdr->sh_size)
+ fail ("Impossible, merged string table is larger", fname);
+
+ /* section index mapping and sanity checking. */
+ size_t newsecndx (size_t secndx, const char *what, size_t widx,
+ const char *member, size_t midx)
+ {
+ if (unlikely (secndx == 0 || secndx == shdrstrndx || secndx >= shdrnum))
+ {
+ /* Don't use fail... too specialized messages. Call release
+ outselves and then error. Ignores midx if widx is
+ zero. */
+ release ();
+ if (widx == 0)
+ error (0, 1, "%s: bad section index %zd in %s for %s",
+ fname, secndx, what, member);
+ else if (midx == 0)
+ error (0, 1, "%s: bad section index %zd in %s %zd for %s",
+ fname, secndx, what, widx, member);
+ else
+ error (0, 1, "%s: bad section index %zd in %s %zd for %s %zd",
+ fname, secndx, what, widx, member, midx);
+ }
+
+ return secndx < shdrstrndx ? secndx : secndx - 1;
+ }
+
+ /* Create a new (temporary) ELF file for the result. */
+ if (replace)
+ {
+ size_t fname_len = strlen (fname);
+ fnew = malloc (fname_len + sizeof (".XXXXXX"));
+ if (fnew == NULL)
+ fail_errno ("couldn't allocate memory for new file name", NULL);
+ strcpy (mempcpy (fnew, fname, fname_len), ".XXXXXX");
+
+ fdnew = mkstemp (fnew);
+ }
+ else
+ {
+ fnew = argv[2];
+ fdnew = open (fnew, O_WRONLY | O_CREAT);
+ }
+
+ if (fdnew < 0)
+ fail_errno ("couldn't create output file", fnew);
+
+ elfnew = elf_begin (fdnew, ELF_C_WRITE, NULL);
+ if (elfnew == NULL)
+ fail_elf ("couldn't open new ELF for writing", fnew);
+
+ /* Create the new ELF header and copy over all the data. */
+ if (gelf_newehdr (elfnew, gelf_getclass (elf)) == 0)
+ fail_elf ("Couldn't create new ehdr", fnew);
+ GElf_Ehdr newehdr;
+ if (gelf_getehdr (elfnew, &newehdr) == NULL)
+ fail_elf ("Couldn't get ehdr", fnew);
+
+ newehdr.e_ident[EI_DATA] = ehdr.e_ident[EI_DATA];
+ newehdr.e_type = ehdr.e_type;
+ newehdr.e_machine = ehdr.e_machine;
+ newehdr.e_version = ehdr.e_version;
+ newehdr.e_entry = ehdr.e_entry;
+ newehdr.e_flags = ehdr.e_flags;
+
+ /* The new file uses the new strtab as shstrtab. */
+ size_t newstrtabndx = newsecndx (strtabndx, "ehdr", 0, "e_shstrndx", 0);
+ if (newstrtabndx < SHN_LORESERVE)
+ newehdr.e_shstrndx = newstrtabndx;
+ else
+ {
+ Elf_Scn *zscn = elf_getscn (elfnew, 0);
+ GElf_Shdr zshdr_mem;
+ GElf_Shdr *zshdr = gelf_getshdr (zscn, &zshdr_mem);
+ if (zshdr == NULL)
+ fail_elf ("Couldn't get section zero", fnew);
+ zshdr->sh_link = strtabndx;
+ if (gelf_update_shdr (zscn, zshdr) == 0)
+ fail_elf ("Couldn't update section zero", fnew);
+ newehdr.e_shstrndx = SHN_XINDEX;
+ }
+
+ if (gelf_update_ehdr (elfnew, &newehdr) == 0)
+ fail ("Couldn't update ehdr", fnew);
+
+ /* Copy the program headers if any. */
+ if (phnum != 0)
+ {
+ if (gelf_newphdr (elfnew, phnum) == 0)
+ fail_elf ("Couldn't create phdrs", fnew);
+
+ for (size_t cnt = 0; cnt < phnum; ++cnt)
+ {
+ GElf_Phdr phdr_mem;
+ GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &phdr_mem);
+ if (phdr == NULL)
+ fail_elf_idx ("Couldn't get phdr", fname, cnt);
+ if (gelf_update_phdr (elfnew, cnt, phdr) == 0)
+ fail_elf_idx ("Couldn't create phdr", fnew, cnt);
+ }
+ }
+
+ newshnums = shdrnum - 1;
+ newscnbufs = calloc (sizeof (void *), newshnums);
+ if (newscnbufs == NULL)
+ fail_errno ("Couldn't allocate memory for new section buffers", NULL);
+
+ /* Copy the sections, except the shstrtab, fill the strtab with the
+ combined strings and adjust section references. */
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ size_t ndx = elf_ndxscn (scn);
+
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+ fail_elf_idx ("Couldn't get shdr", fname, ndx);
+
+ /* Section zero is always created. Skip the shtrtab. */
+ if (ndx == 0 || ndx == shdrstrndx)
+ continue;
+
+ Elf_Scn *newscn = elf_newscn (elfnew);
+ if (newscn == NULL)
+ fail_elf_idx ("couldn't create new section", fnew, ndx);
+
+ GElf_Shdr newshdr;
+ newshdr.sh_name = ebl_strtaboffset (scnstrents[ndx]);
+ newshdr.sh_type = shdr->sh_type;
+ newshdr.sh_flags = shdr->sh_flags;
+ newshdr.sh_addr = shdr->sh_addr;
+ newshdr.sh_size = shdr->sh_size;
+ if (shdr->sh_link != 0)
+ newshdr.sh_link = newsecndx (shdr->sh_link, "shdr", ndx, "sh_link", 0);
+ else
+ newshdr.sh_link = 0;
+ if (SH_INFO_LINK_P (shdr) && shdr->sh_info != 0)
+ newshdr.sh_info = newsecndx (shdr->sh_info, "shdr", ndx, "sh_info", 0);
+ else
+ newshdr.sh_info = shdr->sh_info;
+ newshdr.sh_entsize = shdr->sh_entsize;
+
+ /* Some sections need a new data buffer because they need to
+ manipulate the original data. Allocate and check here, so we
+ have a list of all data buffers we might need to release when
+ done. */
+ void new_data_buf (Elf_Data *d)
+ {
+ size_t s = d->d_size;
+ if (s == 0)
+ fail_idx ("Expected data in section", fname, ndx);
+ void *b = malloc (d->d_size);
+ if (b == NULL)
+ fail_idx ("Couldn't allocated buffer for section", NULL, ndx);
+ newscnbufs[ndx] = d->d_buf = b;
+ }
+
+ Elf_Data *newdata = elf_newdata (newscn);
+ if (newdata == NULL)
+ fail_elf_idx ("Couldn't create new data for section", fnew, ndx);
+ if (ndx == strtabndx)
+ *newdata = newstrtabdata;
+ else
+ {
+ /* The symtab, dynsym, group and symtab_shndx sections
+ contain section indexes. Symbol tables (symtab and
+ dynsym) contain indexes to strings. Update both if
+ necessary. */
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ fail_elf_idx ("Couldn't get data from section", fname, ndx);
+ *newdata = *data;
+ switch (shdr->sh_type)
+ {
+ case SHT_SYMTAB:
+ case SHT_DYNSYM:
+ {
+ /* We need to update the section numbers of the
+ symbols and if this symbol table uses the strtab
+ section also the name indexes. */
+ const bool update_name = shdr->sh_link == strtabndx;
+ new_data_buf (newdata);
+ size_t syms = (data->d_size
+ / gelf_fsize (elf, ELF_T_SYM, 1, EV_CURRENT));
+ for (size_t i = 0; i < syms; i++)
+ {
+ GElf_Sym sym;
+ if (gelf_getsym (data, i, &sym) == NULL)
+ fail_elf_idx ("Couldn't get symbol", fname, i);
+
+ if (sym.st_shndx != SHN_UNDEF
+ && sym.st_shndx < SHN_LORESERVE)
+ sym.st_shndx = newsecndx (sym.st_shndx, "section", ndx,
+ "symbol", i);
+ if (update_name && sym.st_name != 0)
+ sym.st_name = ebl_strtaboffset (symstrents[i]);
+
+ /* We explicitly don't update the SHNDX table at
+ the same time, we do that below. */
+ if (gelf_update_sym (newdata, i, &sym) == 0)
+ fail_elf_idx ("Couldn't update symbol", fnew, i);
+ }
+ }
+ break;
+
+ case SHT_GROUP:
+ {
+ new_data_buf (newdata);
+ /* A section group contains Elf32_Words. The first
+ word is a falg value, the rest of the words are
+ indexes of the sections belonging to the group. */
+ Elf32_Word *group = (Elf32_Word *) data->d_buf;
+ Elf32_Word *newgroup = (Elf32_Word *) newdata->d_buf;
+ size_t words = data->d_size / sizeof (Elf32_Word);
+ if (words == 0)
+ fail_idx ("Not enough data in group section", fname, ndx);
+ newgroup[0] = group[0];
+ for (size_t i = 1; i < words; i++)
+ newgroup[i] = newsecndx (group[i], "section", ndx,
+ "group", i);
+ }
+ break;
+
+ case SHT_SYMTAB_SHNDX:
+ {
+ new_data_buf (newdata);
+ /* A SHNDX just contains an array of section indexes
+ for the corresponding symbol table. The entry is
+ SHN_UNDEF unless the corresponding symbol is
+ SHN_XINDEX. */
+ Elf32_Word *shndx = (Elf32_Word *) data->d_buf;
+ Elf32_Word *newshndx = (Elf32_Word *) newdata->d_buf;
+ size_t words = data->d_size / sizeof (Elf32_Word);
+ for (size_t i = 0; i < words; i++)
+ if (shndx[i] == SHN_UNDEF)
+ newshndx[i] = SHN_UNDEF;
+ else
+ newshndx[i] = newsecndx (shndx[i], "section", ndx,
+ "shndx", i);
+ }
+ break;
+
+ case SHT_DYNAMIC:
+ /* Fallthrough. There are string indexes in here, but
+ they (should) point to a allocated string table,
+ which we don't alter. */
+ default:
+ /* Nothing to do. Section data doesn't contain section
+ or strtab indexes. */
+ break;
+ }
+ }
+
+ /* When we are responsible for the layout explicitly set
+ sh_addralign, sh_size and sh_offset. Otherwise libelf will
+ calculate those from the Elf_Data. */
+ if (layout)
+ {
+ /* Zero means one. No alignment constraints. */
+ newshdr.sh_addralign = shdr->sh_addralign ?: 1;
+
+ /* We have just one Elf_Data. */
+ newshdr.sh_size = newdata->d_size;
+
+ /* Keep the offset of allocated sections so they are at the
+ same place in the file. Add unallocated ones after the
+ allocated ones. */
+ if ((shdr->sh_flags & SHF_ALLOC) != 0)
+ newshdr.sh_offset = shdr->sh_offset;
+ else
+ {
+ newshdr.sh_offset = ((last_offset + newshdr.sh_addralign - 1)
+ & ~(newshdr.sh_addralign - 1));
+ if (newshdr.sh_type != SHT_NOBITS)
+ last_offset = newshdr.sh_offset + newshdr.sh_size;
+ }
+ }
+
+ if (gelf_update_shdr (newscn, &newshdr) == 0)
+ fail_elf_idx ("Couldn't update section header", fnew, ndx);
+ }
+
+ /* If we have phdrs we want elf_update to layout the SHF_ALLOC
+ sections precisely as in the original file. In that case we are
+ also responsible for setting phoff and shoff */
+ if (layout)
+ {
+ /* Position the shdrs after the last (unallocated) section. */
+ if (gelf_getehdr (elfnew, &newehdr) == NULL)
+ fail_elf ("Couldn't get ehdr", fnew);
+ const size_t offsize = gelf_fsize (elf, ELF_T_OFF, 1, EV_CURRENT);
+ newehdr.e_shoff = ((last_offset + offsize - 1)
+ & ~((GElf_Off) (offsize - 1)));
+
+ /* The phdrs go in the same place as in the original file.
+ Normally right after the ELF header. */
+ newehdr.e_phoff = ehdr.e_phoff;
+
+ if (gelf_update_ehdr (elfnew, &newehdr) == 0)
+ fail_elf ("Couldn't update ehdr", fnew);
+
+ elf_flagelf (elfnew, ELF_C_SET, ELF_F_LAYOUT);
+ }
+
+ if (elf_update (elfnew, ELF_C_WRITE) == -1)
+ fail_elf ("Couldn't write ELF", fnew);
+
+ elf_end (elfnew);
+ elfnew = NULL;
+
+ /* Finally replace the old file with the new merge strings file. */
+ const char *fout;
+ if (replace)
+ {
+ fout = fname;
+ if (rename (fnew, fout) != 0)
+ fail_errno ("rename", fout);
+ }
+ else
+ fout = fnew;
+
+ struct stat st;
+ if (fstat (fd, &st) != 0)
+ error (0, errno, "Couldn't stat: %s", fname);
+ else
+ {
+ if (fchmod (fdnew, st.st_mode & ALLPERMS) != 0)
+ error (0, errno, "Couldn't fchmod %s", fout);
+ if (fchown (fdnew, st.st_uid, st.st_gid) != 0)
+ error (0, errno, "Couldn't fchown %s", fout);
+ }
+
+ /* We are finally done with the new file, don't unlink it now. */
+ close (fdnew);
+ if (replace)
+ free (fnew);
+ fnew = NULL;
+ fdnew = -1;
+
+ release ();
+ return 0;
+}
diff --git a/tests/run-strip-strmerge.sh b/tests/run-strip-strmerge.sh
new file mode 100755
index 0000000..aa9c1eb
--- /dev/null
+++ b/tests/run-strip-strmerge.sh
@@ -0,0 +1,79 @@
+#! /bin/sh
+# Copyright (C) 2015 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# Generate a file with merged .shstrtab/.strtab table.
+# strip and unstrip it. Check all files with elflint.
+
+# A random ET_EXEC file
+input=${abs_top_builddir}/tests/elfstrmerge
+merged=merged.elf
+stripped=${merged}.stripped
+debugfile=${merged}.debug
+remerged=remerged.elf
+
+tempfiles $merged $stripped $debugfile $remerged
+
+echo elflint $input
+testrun ${abs_top_builddir}/src/elflint --gnu $input
+echo elfstrmerge
+testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
+echo elflint $merged
+testrun ${abs_top_builddir}/src/elflint --gnu $merged
+echo strip
+testrun ${abs_top_builddir}/src/strip -o $stripped -f $debugfile $merged
+echo elflint $stripped
+testrun ${abs_top_builddir}/src/elflint --gnu $stripped
+echo elflint $debugfile
+testrun ${abs_top_builddir}/src/elflint --gnu -d $debugfile
+echo unstrip
+testrun ${abs_top_builddir}/src/unstrip -o $remerged $stripped $debugfile
+echo elflint $remerged
+testrun ${abs_top_builddir}/src/elflint --gnu $remerged
+echo elfcmp
+testrun ${abs_top_builddir}/src/elfcmp $merged $remerged
+
+# A random ET_REL file
+input=${abs_top_builddir}/tests/elfstrmerge.o
+merged=merged.elf
+stripped=${merged}.stripped
+debugfile=${merged}.debug
+remerged=remerged.elf
+
+tempfiles $merged $stripped $debugfile $remerged
+
+echo elflint $input
+testrun ${abs_top_builddir}/src/elflint --gnu $input
+echo elfstrmerge
+testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
+echo elflint $merged
+testrun ${abs_top_builddir}/src/elflint --gnu $merged
+echo strip
+testrun ${abs_top_builddir}/src/strip -o $stripped -f $debugfile $merged
+echo elflint $stripped
+testrun ${abs_top_builddir}/src/elflint --gnu $stripped
+echo elflint $debugfile
+testrun ${abs_top_builddir}/src/elflint --gnu -d $debugfile
+echo unstrip
+testrun ${abs_top_builddir}/src/unstrip -o $remerged $stripped $debugfile
+echo elflint $remerged
+testrun ${abs_top_builddir}/src/elflint --gnu $remerged
+echo elfcmp
+testrun ${abs_top_builddir}/src/elfcmp $merged $remerged
+
+exit 0
--
2.4.3
8 years, 6 months
[PATCH] libelf: Always update e_version and e_shentsize in elf_update.
by Mark Wielaard
When e_version is EV_NONE we should set it to EV_CURRENT like we do for
the EI_VERSION and like we set EI_DATA to the correct byte order when set
to ELFDATANONE. Likewise we should always set e_shentsize like we do for
e_phentsize, not just when ELF_F_LAYOUT isn't set.
Add a new elfshphehdr testcase to check the above.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 5 ++
libelf/elf32_updatenull.c | 13 ++--
tests/ChangeLog | 7 ++
tests/Makefile.am | 7 +-
tests/elfshphehdr.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 207 insertions(+), 7 deletions(-)
create mode 100644 tests/elfshphehdr.c
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 1916877..0609b37 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-29 Mark Wielaard <mjw(a)redhat.com>
+
+ * elf32_updatenull.c (default_ehdr): Set e_version when EV_NONE.
+ (updatenull_wrlock): Always set e_shentsize.
+
2015-09-23 Mark Wielaard <mjw(a)redhat.com>
* elf32_getehdr.c (getehdr_wrlock): Mark as internal_function.
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
index c59ffcb..d3754d3 100644
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -84,8 +84,12 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr,
update_if_changed (ehdr->e_ident[EI_VERSION], EV_CURRENT,
elf->state.ELFW(elf,LIBELFBITS).ehdr_flags);
- if (unlikely (ehdr->e_version == EV_NONE)
- || unlikely (ehdr->e_version >= EV_NUM))
+ if (unlikely (ehdr->e_version == EV_NONE))
+ {
+ ehdr->e_version = EV_CURRENT;
+ elf->state.ELFW(elf,LIBELFBITS).ehdr_flags |= ELF_F_DIRTY;
+ }
+ else if (unlikely (ehdr->e_version >= EV_NUM))
{
__libelf_seterrno (ELF_E_UNKNOWN_VERSION);
return 1;
@@ -394,6 +398,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
while ((list = list->next) != NULL);
/* Store section information. */
+ update_if_changed (ehdr->e_shentsize,
+ elf_typesize (LIBELFBITS, ELF_T_SHDR, 1), ehdr_flags);
if (elf->flags & ELF_F_LAYOUT)
{
/* The user is supposed to fill out e_shoff. Use it and
@@ -414,9 +420,6 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
- update_if_changed (ehdr->e_shentsize,
- elf_typesize (LIBELFBITS, ELF_T_SHDR, 1),
- ehdr_flags);
/* Account for the section header size. */
size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b8ac61d..0f8925e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-29 Mark Wielaard <mjw(a)redhat.com>
+
+ * elfshphehdr.c: New test.
+ * Makefile.am (check_PROGRAMS): Add elfshphehdr.
+ (TESTS): Likewise.
+ (elfshphehdr_LDADD): New variable.
+
2015-09-08 Mark Wielaard <mjw(a)redhat.com>
* dwfl-proc-attach.c: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ca2c2d7..eaa904c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,7 +51,8 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
dwfl-report-elf-align varlocs backtrace backtrace-child \
backtrace-data backtrace-dwarf debuglink debugaltlink \
buildid deleted deleted-lib.so aggregate_size vdsosyms \
- getsrc_die strptr newdata elfstrtab dwfl-proc-attach
+ getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
+ elfshphehdr
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -118,7 +119,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-stack-demangled-test.sh \
run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh \
- run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach
+ run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
+ elfshphehdr
if !BIARCH
export ELFUTILS_DISABLE_BIARCH = 1
@@ -448,6 +450,7 @@ newdata_LDADD = $(libelf)
elfstrtab_LDADD = $(libelf)
dwfl_proc_attach_LDADD = $(libdw)
dwfl_proc_attach_LDFLAGS = -pthread
+elfshphehdr_LDADD =$(libelf)
if GCOV
check: check-am coverage
diff --git a/tests/elfshphehdr.c b/tests/elfshphehdr.c
new file mode 100644
index 0000000..5f6b96c
--- /dev/null
+++ b/tests/elfshphehdr.c
@@ -0,0 +1,182 @@
+/* Test program for adding section and program headers and ehdr updates.
+ Copyright (C) 2015 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <assert.h>
+#include ELFUTILS_HEADER(elf)
+#include <gelf.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <stdbool.h>
+
+void
+check (const char *msg, bool check)
+{
+ if (! check)
+ {
+ fprintf (stderr, "%s FAILED\n", msg);
+ exit (-1);
+ }
+ else
+ fprintf (stderr, "%s OK\n", msg);
+}
+
+void
+check_elf (const char *msg, bool check)
+{
+ if (! check)
+ {
+ fprintf (stderr, "%s: %s\n", msg, elf_errmsg (-1));
+ exit (-1);
+ }
+ else
+ fprintf (stderr, "%s OK\n", msg);
+}
+
+void
+test (Elf *elf, int class, bool layout)
+{
+ fprintf (stderr, "testing ELF class: %d, layout: %d\n", class, layout);
+
+ check_elf ("gelf_newehdr", gelf_newehdr (elf, class) != 0);
+ check_elf ("gelf_getclass", gelf_getclass (elf) == class);
+
+ check_elf ("elf_flagelf", elf_flagelf (elf, layout ? ELF_C_SET : ELF_C_CLR,
+ ELF_F_LAYOUT) != 0);
+
+ GElf_Ehdr ehdr;
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ check ("e_shnum == 0", ehdr.e_shnum == 0);
+ check ("e_phnum == 0", ehdr.e_phnum == 0);
+ check ("e_shoff == 0", ehdr.e_shoff == 0);
+ check ("e_phoff == 0", ehdr.e_phoff == 0);
+
+ size_t shnum;
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 0", shnum == 0);
+
+ size_t phnum;
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) == 0);
+ check ("phnum == 0", phnum == 0);
+
+ /* Lets fill in some info we are always responsible for. */
+ ehdr.e_ident[EI_DATA] = ELFDATANONE; /* Ask for native encoding. */
+ ehdr.e_type = ET_EXEC;
+ ehdr.e_machine = EM_386;
+ ehdr.e_version = EV_NONE; /* Ask for current version. */
+ check_elf ("gelf_update_ehdr", gelf_update_ehdr (elf, &ehdr) != 0);
+
+ check_elf ("elf_update", elf_update (elf, ELF_C_NULL) > 0);
+
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ check ("EI_DATA", ehdr.e_ident[EI_DATA] != ELFDATANONE);
+ check ("e_version", ehdr.e_version == EV_CURRENT);
+
+ /* The sh/ph values shouldn't have changed. */
+ check ("e_shnum == 0", ehdr.e_shnum == 0);
+ check ("e_phnum == 0", ehdr.e_phnum == 0);
+ check ("e_shoff == 0", ehdr.e_shoff == 0);
+ check ("e_phoff == 0", ehdr.e_phoff == 0);
+
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 0", shnum == 0);
+
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) == 0);
+ check ("phnum == 0", phnum == 0);
+
+ /* Lets add a header. */
+ check_elf ("elf_newscn", elf_newscn (elf) != NULL);
+ check_elf ("gelf_newphdr", gelf_newphdr (elf, 1) != 0);
+
+ /* If we are responsible for the layout ourselves we should also
+ tell where to put them. */
+ if (layout)
+ {
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ /* phdrs go right after the ehdr. */
+ ehdr.e_phoff = ehdr.e_ehsize;
+ /* shdrs go right after the phdrs. */
+ ehdr.e_shoff = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize;
+ check_elf ("gelf_update_ehdr", gelf_update_ehdr (elf, &ehdr) != 0);
+ }
+
+ check_elf ("elf_update", elf_update (elf, ELF_C_NULL) > 0);
+
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 1", shnum == 2); /* section zero is also created. */
+
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) != 0);
+ check ("phnum == 1", phnum == 1);
+
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+
+ check ("EI_DATA", ehdr.e_ident[EI_DATA] != ELFDATANONE);
+ check ("e_version", ehdr.e_version == EV_CURRENT);
+
+ check ("e_shnum == 2", ehdr.e_shnum == 2);
+ check ("e_phnum == 1", ehdr.e_phnum == 1);
+ check ("e_shoff != 0", ehdr.e_shoff != 0);
+ check ("e_phoff != 0", ehdr.e_phoff != 0);
+
+ size_t shentsize = (class == ELFCLASS32
+ ? sizeof (Elf32_Shdr) : sizeof (Elf64_Shdr));
+ check ("e_shentsize", ehdr.e_shentsize == shentsize);
+ size_t phentsize = (class == ELFCLASS32
+ ? sizeof (Elf32_Phdr) : sizeof (Elf64_Phdr));
+ check ("e_phentsize", ehdr.e_phentsize == phentsize);
+}
+
+int
+main (int argc __attribute__ ((unused)), char **argv __attribute ((unused)))
+{
+ elf_version (EV_CURRENT);
+
+ int fd = fd = open("/dev/zero", O_WRONLY);
+ check ("open", fd >= 0);
+
+ Elf *elf;
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS32, false);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS32, true);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS64, false);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS64, true);
+ elf_end (elf);
+
+ close (fd);
+ return 0;
+}
--
2.4.3
8 years, 6 months
[PATCH] Move 4 libdwfl nested functions.
by Chih-Hung Hsieh
Now they should compile with clang.
Used local variables are passed to new file scope functions
as constant parameters, or pointers, or embedded in a
'state' structure.
One simple function "report" is changed to a macro.
It triggers a gcc false positive -Werror=maybe-uninitialized,
so the local variables are explicitly initialized.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdwfl/ChangeLog | 16 ++++
libdwfl/linux-kernel-modules.c | 120 +++++++++++++++------------
libdwfl/relocate.c | 184 ++++++++++++++++++++++-------------------
3 files changed, 182 insertions(+), 138 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0ab386f..b9f42a1 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,19 @@
+2015-09-18 Chih-Hung Hsieh <chh(a)google.com>
+
+ * relocate.c (relocate_section): Move nested function "relocate"
+ to file scope, pass all used local variables as constants.
+ Move nested "check_badreltype" to file scope, pass addresses of
+ updated used local variables.
+ * linux-kernel-modules.c (intuit_kernel_bounds): Move nested function
+ "read_address" to file scope, pass all updated local variables in
+ a state structure.
+ * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Move nested
+ function "subst_name" to file scope, pass all used local variables
+ as constants.
+ * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Replace
+ simple nested function "report" with a macro. Work around gcc static
+ analysis error -Werror=maybe-uninitialized.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
Mark Wielaard <mjw(a)redhat.com>
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 236e2cd..dafe893 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -440,46 +440,55 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
INTDEF (dwfl_linux_kernel_report_offline)
+/* State of read_address used by intuit_kernel_bounds. */
+struct read_address_state {
+ FILE *f;
+ char *line;
+ size_t linesz;
+ size_t n;
+ char *p;
+ const char *type;
+};
+
+static inline bool
+read_address (struct read_address_state *state, Dwarf_Addr *addr)
+{
+ if ((state->n = getline (&state->line, &state->linesz, state->f)) < 1 ||
+ state->line[state->n - 2] == ']')
+ return false;
+ *addr = strtoull (state->line, &state->p, 16);
+ state->p += strspn (state->p, " \t");
+ state->type = strsep (&state->p, " \t\n");
+ if (state->type == NULL)
+ return false;
+ return state->p != NULL && state->p != state->line;
+}
+
+
/* Grovel around to guess the bounds of the runtime kernel image. */
static int
intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
{
- FILE *f = fopen (KSYMSFILE, "r");
- if (f == NULL)
+ struct read_address_state state = { NULL, NULL, 0, 0, NULL, NULL };
+
+ state.f = fopen (KSYMSFILE, "r");
+ if (state.f == NULL)
return errno;
- (void) __fsetlocking (f, FSETLOCKING_BYCALLER);
+ (void) __fsetlocking (state.f, FSETLOCKING_BYCALLER);
*notes = 0;
- char *line = NULL;
- size_t linesz = 0;
- size_t n;
- char *p = NULL;
- const char *type;
-
- inline bool read_address (Dwarf_Addr *addr)
- {
- if ((n = getline (&line, &linesz, f)) < 1 || line[n - 2] == ']')
- return false;
- *addr = strtoull (line, &p, 16);
- p += strspn (p, " \t");
- type = strsep (&p, " \t\n");
- if (type == NULL)
- return false;
- return p != NULL && p != line;
- }
-
int result;
do
- result = read_address (start) ? 0 : -1;
- while (result == 0 && strchr ("TtRr", *type) == NULL);
+ result = read_address (&state, start) ? 0 : -1;
+ while (result == 0 && strchr ("TtRr", *state.type) == NULL);
if (result == 0)
{
*end = *start;
- while (read_address (end))
- if (*notes == 0 && !strcmp (p, "__start_notes\n"))
+ while (read_address (&state, end))
+ if (*notes == 0 && !strcmp (state.p, "__start_notes\n"))
*notes = *end;
Dwarf_Addr round_kernel = sysconf (_SC_PAGE_SIZE);
@@ -489,12 +498,12 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
if (*start >= *end || *end - *start < round_kernel)
result = -1;
}
- free (line);
+ free (state.line);
if (result == -1)
- result = ferror_unlocked (f) ? errno : ENOEXEC;
+ result = ferror_unlocked (state.f) ? errno : ENOEXEC;
- fclose (f);
+ fclose (state.f);
return result;
}
@@ -619,12 +628,11 @@ check_module_notes (Dwfl_Module *mod)
int
dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
{
- Dwarf_Addr start;
- Dwarf_Addr end;
- inline Dwfl_Module *report (void)
- {
- return INTUSE(dwfl_report_module) (dwfl, KERNEL_MODNAME, start, end);
- }
+ Dwarf_Addr start = 0;
+ Dwarf_Addr end = 0;
+
+ #define report() \
+ (INTUSE(dwfl_report_module) (dwfl, KERNEL_MODNAME, start, end))
/* This is a bit of a kludge. If we already reported the kernel,
don't bother figuring it out again--it never changes. */
@@ -657,6 +665,29 @@ dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
INTDEF (dwfl_linux_kernel_report_kernel)
+static inline bool
+subst_name (char from, char to,
+ const char * const module_name,
+ char * const alternate_name,
+ const size_t namelen)
+{
+ const char *n = memchr (module_name, from, namelen);
+ if (n == NULL)
+ return false;
+ char *a = mempcpy (alternate_name, module_name, n - module_name);
+ *a++ = to;
+ ++n;
+ const char *p;
+ while ((p = memchr (n, from, namelen - (n - module_name))) != NULL)
+ {
+ a = mempcpy (a, n, p - n);
+ *a++ = to;
+ n = p + 1;
+ }
+ memcpy (a, n, namelen - (n - module_name) + 1);
+ return true;
+}
+
/* Dwfl_Callbacks.find_elf for the running Linux kernel and its modules. */
int
@@ -713,25 +744,8 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
free (modulesdir[0]);
return ENOMEM;
}
- inline bool subst_name (char from, char to)
- {
- const char *n = memchr (module_name, from, namelen);
- if (n == NULL)
- return false;
- char *a = mempcpy (alternate_name, module_name, n - module_name);
- *a++ = to;
- ++n;
- const char *p;
- while ((p = memchr (n, from, namelen - (n - module_name))) != NULL)
- {
- a = mempcpy (a, n, p - n);
- *a++ = to;
- n = p + 1;
- }
- memcpy (a, n, namelen - (n - module_name) + 1);
- return true;
- }
- if (!subst_name ('-', '_') && !subst_name ('_', '-'))
+ if (!subst_name ('-', '_', module_name, alternate_name, namelen) &&
+ !subst_name ('_', '-', module_name, alternate_name, namelen))
alternate_name[0] = '\0';
FTSENT *f;
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index e102e1e..2dc6737 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -277,77 +277,18 @@ resolve_symbol (Dwfl_Module *referer, struct reloc_symtab_cache *symtab,
return DWFL_E_RELUNDEF;
}
+/* Apply one relocation. Returns true for any invalid data. */
static Dwfl_Error
-relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
- size_t shstrndx, struct reloc_symtab_cache *reloc_symtab,
- Elf_Scn *scn, GElf_Shdr *shdr,
- Elf_Scn *tscn, bool debugscn, bool partial)
+relocate (Dwfl_Module * const mod,
+ Elf * const relocated,
+ struct reloc_symtab_cache * const reloc_symtab,
+ Elf_Data * const tdata,
+ const GElf_Ehdr * const ehdr,
+ GElf_Addr offset,
+ const GElf_Sxword *addend,
+ int rtype,
+ int symndx)
{
- /* First, fetch the name of the section these relocations apply to. */
- GElf_Shdr tshdr_mem;
- GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem);
- const char *tname = elf_strptr (relocated, shstrndx, tshdr->sh_name);
- if (tname == NULL)
- return DWFL_E_LIBELF;
-
- if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0))
- /* No contents to relocate. */
- return DWFL_E_NOERROR;
-
- if (debugscn && ! ebl_debugscn_p (mod->ebl, tname))
- /* This relocation section is not for a debugging section.
- Nothing to do here. */
- return DWFL_E_NOERROR;
-
- /* Fetch the section data that needs the relocations applied. */
- Elf_Data *tdata = elf_rawdata (tscn, NULL);
- if (tdata == NULL)
- return DWFL_E_LIBELF;
-
- /* If either the section that needs the relocation applied, or the
- section that the relocations come from overlap one of the ehdrs,
- shdrs or phdrs data then we refuse to do the relocations. It
- isn't illegal for ELF section data to overlap the header data,
- but updating the (relocation) data might corrupt the in-memory
- libelf headers causing strange corruptions or errors. */
- size_t ehsize = gelf_fsize (relocated, ELF_T_EHDR, 1, EV_CURRENT);
- if (unlikely (shdr->sh_offset < ehsize
- || tshdr->sh_offset < ehsize))
- return DWFL_E_BADELF;
-
- GElf_Off shdrs_start = ehdr->e_shoff;
- size_t shnums;
- if (elf_getshdrnum (relocated, &shnums) < 0)
- return DWFL_E_LIBELF;
- /* Overflows will have been checked by elf_getshdrnum/get|rawdata. */
- size_t shentsize = gelf_fsize (relocated, ELF_T_SHDR, 1, EV_CURRENT);
- GElf_Off shdrs_end = shdrs_start + shnums * shentsize;
- if (unlikely ((shdrs_start < shdr->sh_offset + shdr->sh_size
- && shdr->sh_offset < shdrs_end)
- || (shdrs_start < tshdr->sh_offset + tshdr->sh_size
- && tshdr->sh_offset < shdrs_end)))
- return DWFL_E_BADELF;
-
- GElf_Off phdrs_start = ehdr->e_phoff;
- size_t phnums;
- if (elf_getphdrnum (relocated, &phnums) < 0)
- return DWFL_E_LIBELF;
- if (phdrs_start != 0 && phnums != 0)
- {
- /* Overflows will have been checked by elf_getphdrnum/get|rawdata. */
- size_t phentsize = gelf_fsize (relocated, ELF_T_PHDR, 1, EV_CURRENT);
- GElf_Off phdrs_end = phdrs_start + phnums * phentsize;
- if (unlikely ((phdrs_start < shdr->sh_offset + shdr->sh_size
- && shdr->sh_offset < phdrs_end)
- || (phdrs_start < tshdr->sh_offset + tshdr->sh_size
- && tshdr->sh_offset < phdrs_end)))
- return DWFL_E_BADELF;
- }
-
- /* Apply one relocation. Returns true for any invalid data. */
- Dwfl_Error relocate (GElf_Addr offset, const GElf_Sxword *addend,
- int rtype, int symndx)
- {
/* First see if this is a reloc we can handle.
If we are skipping it, don't bother resolving the symbol. */
@@ -482,7 +423,89 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
/* We have applied this relocation! */
return DWFL_E_NOERROR;
- }
+}
+
+static inline void
+check_badreltype (bool *first_badreltype,
+ Dwfl_Module *mod,
+ Dwfl_Error *result)
+{
+ if (*first_badreltype)
+ {
+ *first_badreltype = false;
+ if (ebl_get_elfmachine (mod->ebl) == EM_NONE)
+ /* This might be because ebl_openbackend failed to find
+ any libebl_CPU.so library. Diagnose that clearly. */
+ *result = DWFL_E_UNKNOWN_MACHINE;
+ }
+}
+
+static Dwfl_Error
+relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
+ size_t shstrndx, struct reloc_symtab_cache *reloc_symtab,
+ Elf_Scn *scn, GElf_Shdr *shdr,
+ Elf_Scn *tscn, bool debugscn, bool partial)
+{
+ /* First, fetch the name of the section these relocations apply to. */
+ GElf_Shdr tshdr_mem;
+ GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem);
+ const char *tname = elf_strptr (relocated, shstrndx, tshdr->sh_name);
+ if (tname == NULL)
+ return DWFL_E_LIBELF;
+
+ if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0))
+ /* No contents to relocate. */
+ return DWFL_E_NOERROR;
+
+ if (debugscn && ! ebl_debugscn_p (mod->ebl, tname))
+ /* This relocation section is not for a debugging section.
+ Nothing to do here. */
+ return DWFL_E_NOERROR;
+
+ /* Fetch the section data that needs the relocations applied. */
+ Elf_Data *tdata = elf_rawdata (tscn, NULL);
+ if (tdata == NULL)
+ return DWFL_E_LIBELF;
+
+ /* If either the section that needs the relocation applied, or the
+ section that the relocations come from overlap one of the ehdrs,
+ shdrs or phdrs data then we refuse to do the relocations. It
+ isn't illegal for ELF section data to overlap the header data,
+ but updating the (relocation) data might corrupt the in-memory
+ libelf headers causing strange corruptions or errors. */
+ size_t ehsize = gelf_fsize (relocated, ELF_T_EHDR, 1, EV_CURRENT);
+ if (unlikely (shdr->sh_offset < ehsize
+ || tshdr->sh_offset < ehsize))
+ return DWFL_E_BADELF;
+
+ GElf_Off shdrs_start = ehdr->e_shoff;
+ size_t shnums;
+ if (elf_getshdrnum (relocated, &shnums) < 0)
+ return DWFL_E_LIBELF;
+ /* Overflows will have been checked by elf_getshdrnum/get|rawdata. */
+ size_t shentsize = gelf_fsize (relocated, ELF_T_SHDR, 1, EV_CURRENT);
+ GElf_Off shdrs_end = shdrs_start + shnums * shentsize;
+ if (unlikely ((shdrs_start < shdr->sh_offset + shdr->sh_size
+ && shdr->sh_offset < shdrs_end)
+ || (shdrs_start < tshdr->sh_offset + tshdr->sh_size
+ && tshdr->sh_offset < shdrs_end)))
+ return DWFL_E_BADELF;
+
+ GElf_Off phdrs_start = ehdr->e_phoff;
+ size_t phnums;
+ if (elf_getphdrnum (relocated, &phnums) < 0)
+ return DWFL_E_LIBELF;
+ if (phdrs_start != 0 && phnums != 0)
+ {
+ /* Overflows will have been checked by elf_getphdrnum/get|rawdata. */
+ size_t phentsize = gelf_fsize (relocated, ELF_T_PHDR, 1, EV_CURRENT);
+ GElf_Off phdrs_end = phdrs_start + phnums * phentsize;
+ if (unlikely ((phdrs_start < shdr->sh_offset + shdr->sh_size
+ && shdr->sh_offset < phdrs_end)
+ || (phdrs_start < tshdr->sh_offset + tshdr->sh_size
+ && tshdr->sh_offset < phdrs_end)))
+ return DWFL_E_BADELF;
+ }
/* Fetch the relocation section and apply each reloc in it. */
Elf_Data *reldata = elf_getdata (scn, NULL);
@@ -491,17 +514,6 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
Dwfl_Error result = DWFL_E_NOERROR;
bool first_badreltype = true;
- inline void check_badreltype (void)
- {
- if (first_badreltype)
- {
- first_badreltype = false;
- if (ebl_get_elfmachine (mod->ebl) == EM_NONE)
- /* This might be because ebl_openbackend failed to find
- any libebl_CPU.so library. Diagnose that clearly. */
- result = DWFL_E_UNKNOWN_MACHINE;
- }
- }
size_t sh_entsize
= gelf_fsize (relocated, shdr->sh_type == SHT_REL ? ELF_T_REL : ELF_T_RELA,
@@ -514,10 +526,11 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
GElf_Rel rel_mem, *r = gelf_getrel (reldata, relidx, &rel_mem);
if (r == NULL)
return DWFL_E_LIBELF;
- result = relocate (r->r_offset, NULL,
+ result = relocate (mod, relocated, reloc_symtab, tdata, ehdr,
+ r->r_offset, NULL,
GELF_R_TYPE (r->r_info),
GELF_R_SYM (r->r_info));
- check_badreltype ();
+ check_badreltype (&first_badreltype, mod, &result);
if (partial)
switch (result)
{
@@ -543,10 +556,11 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
&rela_mem);
if (r == NULL)
return DWFL_E_LIBELF;
- result = relocate (r->r_offset, &r->r_addend,
+ result = relocate (mod, relocated, reloc_symtab, tdata, ehdr,
+ r->r_offset, &r->r_addend,
GELF_R_TYPE (r->r_info),
GELF_R_SYM (r->r_info));
- check_badreltype ();
+ check_badreltype (&first_badreltype, mod, &result);
if (partial)
switch (result)
{
--
2.6.0.rc0.131.gf624c3d
8 years, 6 months
[COMMITTED] Update Ukrainian translation
by Mark Wielaard
From: Yuri Chornoivan <yurchor(a)ukr.net>
https://bugzilla.redhat.com/show_bug.cgi?id=1266682
Signed-off-by: Yuri Chornoivan <yurchor(a)ukr.net>
---
po/uk.po | 699 +++++++++++++++++++++++++++++++++------------------------------
1 file changed, 364 insertions(+), 335 deletions(-)
diff --git a/po/uk.po b/po/uk.po
index 67ca86f..be7782f 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -2,13 +2,13 @@
# Copyright (C) 2010 Free Software Foundation, Inc.
# This file is distributed under the same license as the elfutils package.
#
-# Yuri Chornoivan <yurchor(a)ukr.net>, 2010, 2011, 2012, 2013, 2014.
+# Yuri Chornoivan <yurchor(a)ukr.net>, 2010, 2011, 2012, 2013, 2014, 2015.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://bugzilla.redhat.com/\n"
-"POT-Creation-Date: 2015-06-19 13:25+0200\n"
-"PO-Revision-Date: 2013-10-09 17:50+0300\n"
+"POT-Creation-Date: 2015-09-26 15:11+0300\n"
+"PO-Revision-Date: 2015-09-26 16:41+0300\n"
"Last-Translator: Yuri Chornoivan <yurchor(a)ukr.net>\n"
"Language-Team: Ukrainian <kde-i18n-uk(a)kde.org>\n"
"Language: uk\n"
@@ -23,6 +23,8 @@ msgstr ""
msgid ""
"colorize the output. WHEN defaults to 'always' or can be 'auto' or 'never'"
msgstr ""
+"розфарбовувати виведене. Типові значення «always» (завжди), «auto» (авто) "
+"або «never» (ніколи)"
#: lib/color.c:127
#, c-format
@@ -33,14 +35,19 @@ msgid ""
" - 'never', 'no', 'none'\n"
" - 'auto', 'tty', 'if-tty'\n"
msgstr ""
+"%s: некоректний аргумент «%s» до «--color»\n"
+"коректними аргументами є такі:\n"
+" - «always», «yes», «force»\n"
+" - «never», «no», «none»\n"
+" - «auto», «tty», «if-tty»\n"
#: lib/color.c:190 src/objdump.c:738
#, c-format
msgid "cannot allocate memory"
msgstr "не вдалося розподілити пам’ять"
-#: lib/xmalloc.c:54 lib/xmalloc.c:68 lib/xmalloc.c:82 src/readelf.c:3184
-#: src/readelf.c:3561 src/readelf.c:8309 src/unstrip.c:2126 src/unstrip.c:2331
+#: lib/xmalloc.c:53 lib/xmalloc.c:66 lib/xmalloc.c:78 src/readelf.c:3184
+#: src/readelf.c:3561 src/readelf.c:8310 src/unstrip.c:2150 src/unstrip.c:2355
#, c-format
msgid "memory exhausted"
msgstr "пам’ять вичерпано"
@@ -89,7 +96,7 @@ msgstr "помилка під час спроби виведення даних"
msgid "no backend support available"
msgstr "підтримки серверів не передбачено"
-#: libasm/asm_error.c:84 libdw/dwarf_error.c:59 libdwfl/libdwflP.h:54
+#: libasm/asm_error.c:83 libdw/dwarf_error.c:59 libdwfl/libdwflP.h:54
#: libelf/elf_error.c:63
msgid "unknown error"
msgstr "невідома помилка"
@@ -116,7 +123,7 @@ msgstr "немає відомостей DWARF"
#: libdw/dwarf_error.c:65
msgid "cannot decompress DWARF"
-msgstr ""
+msgstr "не вдалося розпакувати DWARF"
#: libdw/dwarf_error.c:66
msgid "no ELF file"
@@ -235,15 +242,14 @@ msgid "no alternative debug link found"
msgstr "альтернативного діагностичного посилання не знайдено"
#: libdw/dwarf_error.c:96
-#, fuzzy
msgid "invalid opcode"
-msgstr "некоректний параметр"
+msgstr "некоректний код операції"
#: libdw/dwarf_error.c:97
msgid "not a CU (unit) DIE"
-msgstr ""
+msgstr "не є DIE CU (модуля)"
-#: libdwfl/argp-std.c:46 src/stack.c:642 src/unstrip.c:2273
+#: libdwfl/argp-std.c:46 src/stack.c:642 src/unstrip.c:2297
msgid "Input selection options:"
msgstr "Вибір параметрів виведення даних:"
@@ -457,82 +463,82 @@ msgstr "Некоректний аргумент"
msgid "Not an ET_CORE ELF file"
msgstr "Не є файлом ET_CORE ELF"
-#: libebl/eblbackendname.c:42
+#: libebl/eblbackendname.c:41
msgid "No backend"
msgstr "Немає сервера"
-#: libebl/eblcorenotetypename.c:102 libebl/eblobjecttypename.c:57
-#: libebl/eblobjnotetypename.c:73 libebl/eblosabiname.c:77
-#: libebl/eblsectionname.c:89 libebl/eblsectiontypename.c:119
-#: libebl/eblsegmenttypename.c:83
+#: libebl/eblcorenotetypename.c:98 libebl/eblobjecttypename.c:53
+#: libebl/eblobjnotetypename.c:69 libebl/eblosabiname.c:73
+#: libebl/eblsectionname.c:83 libebl/eblsectiontypename.c:115
+#: libebl/eblsegmenttypename.c:79
msgid "<unknown>"
msgstr "<невідомо>"
-#: libebl/ebldynamictagname.c:105
+#: libebl/ebldynamictagname.c:101
#, c-format
msgid "<unknown>: %#<PRIx64>"
msgstr "<невідомо>: %#<PRIx64>"
-#: libebl/eblobjnote.c:56
+#: libebl/eblobjnote.c:52
#, c-format
msgid "unknown SDT version %u\n"
msgstr "невідома версія SDT, %u\n"
-#: libebl/eblobjnote.c:74
+#: libebl/eblobjnote.c:70
#, c-format
msgid "invalid SDT probe descriptor\n"
msgstr "некоректний дескриптор зондування SDT\n"
-#: libebl/eblobjnote.c:124
+#: libebl/eblobjnote.c:120
#, c-format
msgid " PC: "
msgstr " PC: "
-#: libebl/eblobjnote.c:126
+#: libebl/eblobjnote.c:122
#, c-format
msgid " Base: "
msgstr "Основа: "
-#: libebl/eblobjnote.c:128
+#: libebl/eblobjnote.c:124
#, c-format
msgid " Semaphore: "
msgstr " Семафор: "
-#: libebl/eblobjnote.c:130
+#: libebl/eblobjnote.c:126
#, c-format
msgid " Provider: "
msgstr " Постачальник: "
-#: libebl/eblobjnote.c:132
+#: libebl/eblobjnote.c:128
#, c-format
msgid " Name: "
msgstr "Назва: "
-#: libebl/eblobjnote.c:134
+#: libebl/eblobjnote.c:130
#, c-format
msgid " Args: "
msgstr " Арг.: "
-#: libebl/eblobjnote.c:144
+#: libebl/eblobjnote.c:140
#, c-format
msgid " Build ID: "
msgstr " Ід. збирання: "
-#: libebl/eblobjnote.c:155
+#: libebl/eblobjnote.c:151
#, c-format
msgid " Linker version: %.*s\n"
msgstr " Версія компонувальника: %.*s\n"
-#: libebl/eblobjnote.c:216
+#: libebl/eblobjnote.c:212
#, c-format
msgid " OS: %s, ABI: "
msgstr " ОС: %s, ABI: "
-#: libebl/eblosabiname.c:74
+#: libebl/eblosabiname.c:70
msgid "Stand alone"
msgstr "Окремий"
-#: libebl/eblsymbolbindingname.c:71 libebl/eblsymboltypename.c:77
+#: libebl/eblsymbolbindingname.c:67 libebl/eblsymboltypename.c:73
#, c-format
msgid "<unknown>: %d"
msgstr "<невідомий>: %d"
@@ -639,7 +645,7 @@ msgid "invalid section header"
msgstr "некоректний заголовок розділу"
#: libelf/elf_error.c:187 src/readelf.c:7234 src/readelf.c:7682
-#: src/readelf.c:7783 src/readelf.c:7963
+#: src/readelf.c:7783 src/readelf.c:7964
#, c-format
msgid "invalid data"
msgstr "некоректні дані"
@@ -684,23 +690,20 @@ msgid "file has no program header"
msgstr "у файлі немає заголовка програми"
#: src/addr2line.c:58
-#, fuzzy
msgid "Input format options:"
-msgstr "Вибір параметрів виведення даних:"
+msgstr "Параметри форматування вхідних даних:"
#: src/addr2line.c:60
msgid "Treat addresses as offsets relative to NAME section."
msgstr "Вважати адреси зміщеннями відносно розділу НАЗВА."
#: src/addr2line.c:62
-#, fuzzy
msgid "Output format options:"
-msgstr "Форматування виводу"
+msgstr "Параметри форматування результатів:"
#: src/addr2line.c:63
-#, fuzzy
msgid "Print address before each entry"
-msgstr "Виводити назву файла перед кожним рядком."
+msgstr "Виводити адресу перед кожним записом"
#: src/addr2line.c:64
msgid "Show only base names of source files"
@@ -736,14 +739,14 @@ msgstr ""
#: src/addr2line.c:75
msgid "Show demangled symbols (ARG is always ignored)"
-msgstr ""
+msgstr "Виводити розшифровані символи (АРГ завжди ігнорується)"
#: src/addr2line.c:77
msgid "Print all information on one line, and indent inlines"
-msgstr ""
+msgstr "Вивести усі дані у один рядок і додати відступи до перенесених рядків"
#: src/addr2line.c:79 src/elfcmp.c:72 src/findtextrel.c:67 src/nm.c:99
-#: src/strings.c:75
+#: src/strings.c:79
msgid "Miscellaneous:"
msgstr "Інше:"
@@ -758,7 +761,7 @@ msgstr "[АДРЕСА...]"
#: src/addr2line.c:216 src/ar.c:285 src/elfcmp.c:670 src/elflint.c:235
#: src/findtextrel.c:162 src/ld.c:943 src/nm.c:261 src/objdump.c:177
-#: src/ranlib.c:124 src/readelf.c:500 src/size.c:207 src/strings.c:226
+#: src/ranlib.c:124 src/readelf.c:500 src/size.c:207 src/strings.c:230
#: src/strip.c:218 src/unstrip.c:232
#, c-format
msgid ""
@@ -773,7 +776,7 @@ msgstr ""
#: src/addr2line.c:221 src/ar.c:290 src/elfcmp.c:675 src/elflint.c:240
#: src/findtextrel.c:167 src/ld.c:948 src/nm.c:266 src/objdump.c:182
-#: src/ranlib.c:129 src/readelf.c:505 src/size.c:212 src/strings.c:231
+#: src/ranlib.c:129 src/readelf.c:505 src/size.c:212 src/strings.c:235
#: src/strip.c:223 src/unstrip.c:237
#, c-format
msgid "Written by %s.\n"
@@ -1052,15 +1055,17 @@ msgstr "не вдалося прочитати %s: %s"
#: src/arlib-argp.c:32
msgid "Use zero for uid, gid, and date in archive members."
msgstr ""
+"Використовувати нульове значення для uid, gid, та дати у елементах архіву."
#: src/arlib-argp.c:34
msgid "Use actual uid, gid, and date in archive members."
msgstr ""
+"Використовувати поточні значення для uid, gid, та дати у елементах архіву."
#: src/arlib-argp.c:65
#, c-format
msgid "%s (default)"
-msgstr ""
+msgstr "%s (типово)"
#: src/arlib.c:209
#, c-format
@@ -1159,11 +1164,9 @@ msgid "cannot get content of section %zu in '%s': %s"
msgstr "не вдалося отримати вміст розділу %zu у «%s»: %s"
#: src/elfcmp.c:339
-#, fuzzy, c-format
+#, c-format
msgid "symbol table [%zu] in '%s' has zero sh_entsize"
-msgstr ""
-"\n"
-"Таблиця символів [%2u] «%s» містить %u запис:\n"
+msgstr "таблиця символів [%zu] у «%s» містить нульове значення sh_entsize"
#: src/elfcmp.c:351 src/elfcmp.c:357
#, c-format
@@ -1257,8 +1260,8 @@ msgstr "Некоректне значення «%s» параметра --gaps."
#: src/elfcmp.c:730 src/findtextrel.c:221 src/ldgeneric.c:1757
#: src/ldgeneric.c:4247 src/nm.c:377 src/ranlib.c:157 src/size.c:289
-#: src/strings.c:182 src/strip.c:466 src/strip.c:503 src/unstrip.c:1922
-#: src/unstrip.c:1951
+#: src/strings.c:186 src/strip.c:466 src/strip.c:503 src/unstrip.c:1946
+#: src/unstrip.c:1975
#, c-format
msgid "cannot open '%s'"
msgstr "не вдалося відкрити «%s»"
@@ -1273,7 +1276,7 @@ msgstr "не вдалося створити дескриптор ELF для «%
msgid "cannot create EBL descriptor for '%s'"
msgstr "не вдалося створити дескриптор EBL для «%s»"
-#: src/elfcmp.c:757
+#: src/elfcmp.c:757 src/findtextrel.c:409
#, c-format
msgid "cannot get section header of section %zu: %s"
msgstr "не вдалося отримати заголовок розділу %zu: %s"
@@ -1486,7 +1489,7 @@ msgstr ""
#: src/elflint.c:591 src/elflint.c:1470 src/elflint.c:1521 src/elflint.c:1627
#: src/elflint.c:1963 src/elflint.c:2279 src/elflint.c:2892 src/elflint.c:3055
-#: src/elflint.c:3203 src/elflint.c:3393 src/elflint.c:4297
+#: src/elflint.c:3203 src/elflint.c:3393 src/elflint.c:4327
#, c-format
msgid "section [%2d] '%s': cannot get section data\n"
msgstr "розділ [%2d] «%s»: не вдалося отримати дані розділу\n"
@@ -1644,12 +1647,13 @@ msgstr ""
"розділ [%2d] «%s»: символ %zu: символ TLS без запису заголовка програми TLS\n"
#: src/elflint.c:863
-#, fuzzy, c-format
+#, c-format
msgid ""
"section [%2d] '%s': symbol %zu: TLS symbol but couldn't get TLS program "
"header entry\n"
msgstr ""
-"розділ [%2d] «%s»: символ %zu: символ TLS без запису заголовка програми TLS\n"
+"розділ [%2d] «%s»: символ %zu: маємо символ TLS, але не вдалося отримати "
+"запис заголовка програми TLS\n"
#: src/elflint.c:871
#, c-format
@@ -1761,9 +1765,9 @@ msgid "section [%2d] '%s': symbol %zu: unknown bit set in st_other\n"
msgstr "розділ [%2d] «%s»: символ %zu: невідомий набір бітів у st_other\n"
#: src/elflint.c:1078
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': cannot get section data.\n"
-msgstr "розділ [%2d] «%s»: не вдалося отримати дані розділу\n"
+msgstr "розділ [%2d] «%s»: не вдалося отримати дані розділу.\n"
#: src/elflint.c:1094
#, c-format
@@ -1901,13 +1905,13 @@ msgid "more than one dynamic section present\n"
msgstr "вказано більше одного динамічного розділу\n"
#: src/elflint.c:1640
-#, fuzzy, c-format
+#, c-format
msgid ""
"section [%2d]: referenced as string table for section [%2d] '%s' but section "
"link value is invalid\n"
msgstr ""
-"розділ [%2d] «%s»: надано посилання на таблицю рядків розділу [%2d] «%s», "
-"але типом даних не є SHT_STRTAB\n"
+"розділ [%2d]: надано посилання на таблицю рядків розділу [%2d] «%s», але "
+"значення посилання на розділ є некоректним\n"
#: src/elflint.c:1648
#, c-format
@@ -2040,11 +2044,10 @@ msgstr ""
"таблиць символів\n"
#: src/elflint.c:1920
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': sh_link extended section index [%2d] is invalid\n"
msgstr ""
-"розділ [%2d] «%s»: розділ розширеного покажчика розділів не призначено для "
-"таблиць символів\n"
+"розділ [%2d] «%s»: індекс розширеного розділу sh_link [%2d] є некоректним\n"
#: src/elflint.c:1925
#, c-format
@@ -2122,14 +2125,15 @@ msgstr ""
"діапазону\n"
#: src/elflint.c:2102
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': not enough data\n"
-msgstr "розділ [%2d] «%s»: не вдалося отримати дані: %s\n"
+msgstr "розділ [%2d] «%s»: недостатньо даних\n"
#: src/elflint.c:2114
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': bitmask size zero or not power of 2: %u\n"
-msgstr "розділ [%2d] «%s»: розмір бітової маски не є степенем 2: %u\n"
+msgstr ""
+"розділ [%2d] «%s»: розмір бітової маски є нульовим або не є степенем 2: %u\n"
#: src/elflint.c:2130
#, c-format
@@ -2171,11 +2175,11 @@ msgstr ""
"помилковим\n"
#: src/elflint.c:2216
-#, fuzzy, c-format
+#, c-format
msgid ""
"section [%2d] '%s': mask index for symbol %u in chain for bucket %zu wrong\n"
msgstr ""
-"розділ [%2d] «%s»: значення хешу для символу %u у ланцюжку для блоку %zu є "
+"розділ [%2d] «%s»: індекс маски для символу %u у ланцюжку для блоку %zu є "
"помилковим\n"
#: src/elflint.c:2246
@@ -2213,9 +2217,11 @@ msgstr ""
"динамічних символів\n"
#: src/elflint.c:2292
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': invalid sh_link symbol table section index [%2d]\n"
-msgstr "розділ [%2d] «%s»: некоректний індекс розділу призначення\n"
+msgstr ""
+"розділ [%2d] «%s»: некоректний індекс розділу таблиці символів sh_link "
+"[%2d]\n"
#: src/elflint.c:2300
#, c-format
@@ -2242,19 +2248,19 @@ msgid "sh_link in hash sections [%2zu] '%s' and [%2zu] '%s' not identical\n"
msgstr "sh_link у розділах хешів [%2zu] «%s» і [%2zu] «%s» не збігаються\n"
#: src/elflint.c:2383 src/elflint.c:2448 src/elflint.c:2483
-#, fuzzy, c-format
+#, c-format
msgid "hash section [%2zu] '%s' does not contain enough data\n"
-msgstr "розділ [%2zu] «%s» не повинен бути придатним до виконання\n"
+msgstr "розділ хешу [%2zu] «%s» містить недостатньо даних\n"
#: src/elflint.c:2404
-#, fuzzy, c-format
+#, c-format
msgid "hash section [%2zu] '%s' has zero bit mask words\n"
-msgstr "розділ [%2d] «%s»: група розділів без значення типу word прапорців\n"
+msgstr "розділ хешу [%2zu] «%s» містить нульові слова бітової маски\n"
#: src/elflint.c:2415 src/elflint.c:2459 src/elflint.c:2496
-#, fuzzy, c-format
+#, c-format
msgid "hash section [%2zu] '%s' uses too much data\n"
-msgstr "розділ [%2zu] «%s» має бути розміщено у пам’яті\n"
+msgstr "розділ хешу [%2zu] «%s» використовує надто багато даних\n"
#: src/elflint.c:2430
#, c-format
@@ -2262,11 +2268,13 @@ msgid ""
"hash section [%2zu] '%s' invalid symbol index %<PRIu32> (max_nsyms: "
"%<PRIu32>, nentries: %<PRIu32>\n"
msgstr ""
+"розділ хешу [%2zu] «%s» некоректний індекс символу %<PRIu32> (макс. к-ть "
+"символів: %<PRIu32>, кількість записів: %<PRIu32>\n"
#: src/elflint.c:2517
-#, fuzzy, c-format
+#, c-format
msgid "hash section [%2zu] '%s' invalid sh_entsize\n"
-msgstr "розділ [%2zu]: некоректна назва\n"
+msgstr "розділ хешу [%2zu] «%s» некоректне значення sh_entsize\n"
#: src/elflint.c:2527 src/elflint.c:2531
#, c-format
@@ -2331,9 +2339,9 @@ msgid "section [%2d] '%s': cannot get symbol for signature\n"
msgstr "розділ [%2d] «%s»: не вдалося отримати символ для підпису\n"
#: src/elflint.c:2624
-#, fuzzy, c-format
+#, c-format
msgid "section [%2d] '%s': cannot get symbol name for signature\n"
-msgstr "розділ [%2d] «%s»: не вдалося отримати символ для підпису\n"
+msgstr "розділ [%2d] «%s»: не вдалося отримати назву символу для підпису\n"
#: src/elflint.c:2629
#, c-format
@@ -2377,8 +2385,8 @@ msgstr "розділ [%2d] «%s»: невідомі прапорці групи
#: src/elflint.c:2688
#, c-format
-msgid "section [%2d] '%s': section index %Zu out of range\n"
-msgstr "розділ [%2d] «%s»: індекс розділу %Zu поза межами діапазону\n"
+msgid "section [%2d] '%s': section index %zu out of range\n"
+msgstr "розділ [%2d] «%s»: індекс розділу %zu поза межами діапазону\n"
#: src/elflint.c:2697
#, c-format
@@ -2395,10 +2403,10 @@ msgstr "розділ [%2d] «%s»: група розділів містить і
#: src/elflint.c:2710
#, c-format
msgid ""
-"section [%2d] '%s': element %Zu references section [%2d] '%s' without "
+"section [%2d] '%s': element %zu references section [%2d] '%s' without "
"SHF_GROUP flag set\n"
msgstr ""
-"розділ [%2d] «%s»: елемент %Zu посилається на розділ [%2d] «%s» без "
+"розділ [%2d] «%s»: елемент %zu посилається на розділ [%2d] «%s» без "
"встановленого прапорця SHF_GROUP\n"
#: src/elflint.c:2717
@@ -2541,12 +2549,13 @@ msgstr ""
"розділ [%2d] «%s»: запис %d має некоректне зміщення щодо наступного запису\n"
#: src/elflint.c:3172 src/elflint.c:3348
-#, fuzzy, c-format
+#, c-format
msgid ""
"section [%2d] '%s': entry %d has zero offset to next entry, but sh_info says "
"there are more entries\n"
msgstr ""
-"розділ [%2d] «%s»: запис %d має некоректне зміщення щодо наступного запису\n"
+"розділ [%2d] «%s»: запис %d має нульове зміщення щодо наступного запису, але "
+"за sh_info можна зрозуміти, що записів більше\n"
#: src/elflint.c:3187
#, c-format
@@ -2914,7 +2923,7 @@ msgstr ""
"розділ [%2zu] «%s» не повністю міститься у сегменті запису заголовка "
"програми %d\n"
-#: src/elflint.c:3981
+#: src/elflint.c:3983
#, c-format
msgid ""
"section [%2zu] '%s' has type NOBITS but is read from the file in segment of "
@@ -2923,7 +2932,16 @@ msgstr ""
"розділ [%2zu] «%s» належить до типу NOBITS, але його читання виконується з "
"файла у сегментів запису заголовка програми %d\n"
-#: src/elflint.c:3990
+#: src/elflint.c:4009
+#, c-format
+msgid ""
+"section [%2zu] '%s' has type NOBITS but is read from the file in segment of "
+"program header entry %d and file contents is non-zero\n"
+msgstr ""
+"розділ [%2zu] «%s» належить до типу NOBITS, але його читання виконується з "
+"файла у сегментів запису заголовка програми %d, а вміст файла є ненульовим\n"
+
+#: src/elflint.c:4020
#, c-format
msgid ""
"section [%2zu] '%s' has not type NOBITS but is not read from the file in "
@@ -2932,19 +2950,19 @@ msgstr ""
"розділ [%2zu] «%s» не належить до типу NOBITS, але його читання не "
"виконується з файла у сегментів запису заголовка програми %d\n"
-#: src/elflint.c:4001
+#: src/elflint.c:4031
#, c-format
msgid "section [%2zu] '%s' is executable in nonexecutable segment %d\n"
msgstr "розділ [%2zu] «%s» є виконуваним у невиконуваному сегменті %d\n"
-#: src/elflint.c:4011
+#: src/elflint.c:4041
#, c-format
msgid "section [%2zu] '%s' is writable in unwritable segment %d\n"
msgstr ""
"розділ [%2zu] «%s» є придатним до запису у непридатному до запису сегменті "
"%d\n"
-#: src/elflint.c:4021
+#: src/elflint.c:4051
#, c-format
msgid ""
"section [%2zu] '%s': alloc flag set but section not in any loaded segment\n"
@@ -2952,7 +2970,7 @@ msgstr ""
"розділ [%2zu] «%s»: встановлено прапорець alloc, але розділ не перебуває у "
"жодному завантаженому сегменті\n"
-#: src/elflint.c:4027
+#: src/elflint.c:4057
#, c-format
msgid ""
"section [%2zu] '%s': ELF header says this is the section header string table "
@@ -2961,7 +2979,7 @@ msgstr ""
"розділ [%2zu] «%s»: заголовок ELF повідомляє про те, що це таблиця рядків "
"заголовка розділу, але ця таблиця не належить до типу SHT_TYPE\n"
-#: src/elflint.c:4035
+#: src/elflint.c:4065
#, c-format
msgid ""
"section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"
@@ -2969,17 +2987,17 @@ msgstr ""
"розділ [%2zu] «%s»: придатні до пересування файли не можуть містити "
"динамічних таблиць символів\n"
-#: src/elflint.c:4086
+#: src/elflint.c:4116
#, c-format
msgid "more than one version symbol table present\n"
msgstr "виявлено більше за одну таблицю символів версій\n"
-#: src/elflint.c:4109
+#: src/elflint.c:4139
#, c-format
msgid "INTERP program header entry but no .interp section\n"
msgstr "існує запис заголовка програми INTERP, але не розділ .interp\n"
-#: src/elflint.c:4120
+#: src/elflint.c:4150
#, c-format
msgid ""
"loadable segment [%u] is executable but contains no executable sections\n"
@@ -2987,14 +3005,14 @@ msgstr ""
"придатний до завантаження сегмент [%u] є виконуваним, але не містить "
"виконуваних розділів\n"
-#: src/elflint.c:4126
+#: src/elflint.c:4156
#, c-format
msgid "loadable segment [%u] is writable but contains no writable sections\n"
msgstr ""
"придатний до завантаження розділ [%u] є придатним до запису, але не містить "
"придатних до запису розділів\n"
-#: src/elflint.c:4137
+#: src/elflint.c:4167
#, c-format
msgid ""
"no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section "
@@ -3003,78 +3021,78 @@ msgstr ""
"немає розділу .gnu.versym, хоча існує розділ .gnu.versym_d або .gnu."
"versym_r\n"
-#: src/elflint.c:4150
+#: src/elflint.c:4180
#, c-format
msgid "duplicate version index %d\n"
msgstr "дублікат індексу версії %d\n"
-#: src/elflint.c:4164
+#: src/elflint.c:4194
#, c-format
msgid ".gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n"
msgstr ""
"існує розділ .gnu.versym, але немає розділу .gnu.versym_d або .gnu.versym_r\n"
-#: src/elflint.c:4213
+#: src/elflint.c:4243
#, c-format
msgid "phdr[%d]: unknown core file note type %<PRIu32> at offset %<PRIu64>\n"
msgstr ""
"phdr[%d]: невідомий тип нотатки файла core %<PRIu32> за зміщенням %<PRIu64>\n"
-#: src/elflint.c:4217
+#: src/elflint.c:4247
#, c-format
msgid ""
-"section [%2d] '%s': unknown core file note type %<PRIu32> at offset %Zu\n"
+"section [%2d] '%s': unknown core file note type %<PRIu32> at offset %zu\n"
msgstr ""
"розділ [%2d] «%s»: невідомий тип нотатки файла core %<PRIu32> за зміщенням "
-"%Zu\n"
+"%zu\n"
-#: src/elflint.c:4240
+#: src/elflint.c:4270
#, c-format
-msgid "phdr[%d]: unknown object file note type %<PRIu32> at offset %Zu\n"
+msgid "phdr[%d]: unknown object file note type %<PRIu32> at offset %zu\n"
msgstr ""
-"phdr[%d]: невідомий тип нотатки об’єктного файла %<PRIu32> за зміщенням %Zu\n"
+"phdr[%d]: невідомий тип нотатки об’єктного файла %<PRIu32> за зміщенням %zu\n"
-#: src/elflint.c:4244
+#: src/elflint.c:4274
#, c-format
msgid ""
-"section [%2d] '%s': unknown object file note type %<PRIu32> at offset %Zu\n"
+"section [%2d] '%s': unknown object file note type %<PRIu32> at offset %zu\n"
msgstr ""
"розділ [%2d] «%s»: невідомий тип нотатки об’єктного файла %<PRIu32> за "
-"зміщенням %Zu\n"
+"зміщенням %zu\n"
-#: src/elflint.c:4261
+#: src/elflint.c:4291
#, c-format
msgid "phdr[%d]: no note entries defined for the type of file\n"
msgstr "phdr[%d]: для цього типу файлів не визначено записів нотаток\n"
-#: src/elflint.c:4280
+#: src/elflint.c:4310
#, c-format
msgid "phdr[%d]: cannot get content of note section: %s\n"
msgstr "phdr[%d]: не вдалося отримати вміст розділу нотаток: %s\n"
-#: src/elflint.c:4283
+#: src/elflint.c:4313
#, c-format
msgid "phdr[%d]: extra %<PRIu64> bytes after last note\n"
msgstr "phdr[%d]: зайві %<PRIu64> байтів після останнього запису нотатки\n"
-#: src/elflint.c:4304
+#: src/elflint.c:4334
#, c-format
msgid "section [%2d] '%s': no note entries defined for the type of file\n"
msgstr ""
"розділ [%2d] «%s»: для цього типу файлів не визначено записів нотаток\n"
-#: src/elflint.c:4311
+#: src/elflint.c:4341
#, c-format
msgid "section [%2d] '%s': cannot get content of note section\n"
msgstr "розділ [%2d] «%s»: не вдалося отримати вміст розділу нотаток\n"
-#: src/elflint.c:4314
+#: src/elflint.c:4344
#, c-format
msgid "section [%2d] '%s': extra %<PRIu64> bytes after last note\n"
msgstr ""
"розділ [%2d] «%s»: додаткові %<PRIu64> байтів після останньої нотатки\n"
-#: src/elflint.c:4332
+#: src/elflint.c:4362
#, c-format
msgid ""
"only executables, shared objects, and core files can have program headers\n"
@@ -3082,135 +3100,135 @@ msgstr ""
"заголовки програм можуть бути лише у виконуваних файлів, об’єктних файлів "
"спільного використання або файлів core\n"
-#: src/elflint.c:4347
+#: src/elflint.c:4377
#, c-format
msgid "cannot get program header entry %d: %s\n"
msgstr "не вдалося отримати запис заголовка програми %d: %s\n"
-#: src/elflint.c:4356
+#: src/elflint.c:4386
#, c-format
msgid "program header entry %d: unknown program header entry type %#<PRIx64>\n"
msgstr ""
"запис заголовка програми %d: невідомий тип запису заголовка програми "
"%#<PRIx64>\n"
-#: src/elflint.c:4367
+#: src/elflint.c:4397
#, c-format
msgid "more than one INTERP entry in program header\n"
msgstr "більше за один запис INTERP у заголовку програми\n"
-#: src/elflint.c:4375
+#: src/elflint.c:4405
#, c-format
msgid "more than one TLS entry in program header\n"
msgstr "більше за один запис TLS у заголовку програми\n"
-#: src/elflint.c:4382
+#: src/elflint.c:4412
#, c-format
msgid "static executable cannot have dynamic sections\n"
msgstr "у статичному виконуваному файлі не може бути динамічних розділів\n"
-#: src/elflint.c:4396
+#: src/elflint.c:4426
#, c-format
msgid "dynamic section reference in program header has wrong offset\n"
msgstr ""
"посилання на динамічний розділ у заголовку програми має помилкове зміщення\n"
-#: src/elflint.c:4399
+#: src/elflint.c:4429
#, c-format
msgid "dynamic section size mismatch in program and section header\n"
msgstr ""
"розміри динамічного розділу у заголовку програми та у заголовку розділу не "
"збігаються\n"
-#: src/elflint.c:4409
+#: src/elflint.c:4439
#, c-format
msgid "more than one GNU_RELRO entry in program header\n"
msgstr "більше за один запис GNU_RELRO у заголовку програми\n"
-#: src/elflint.c:4430
+#: src/elflint.c:4460
#, c-format
msgid "loadable segment GNU_RELRO applies to is not writable\n"
msgstr ""
"придатний до завантаження сегмент, до якого звертається GNU_RELRO, "
"непридатний до запису\n"
-#: src/elflint.c:4433
+#: src/elflint.c:4463
#, c-format
msgid "loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"
msgstr ""
"прапорці придатного до завантаження сегмента [%u] не відповідають прапорцям "
"GNU_RELRO [%u]\n"
-#: src/elflint.c:4441 src/elflint.c:4464
+#: src/elflint.c:4471 src/elflint.c:4494
#, c-format
msgid "%s segment not contained in a loaded segment\n"
msgstr "сегмент %s не міститься у завантаженому сегменті\n"
-#: src/elflint.c:4470
+#: src/elflint.c:4500
#, c-format
msgid "program header offset in ELF header and PHDR entry do not match"
msgstr "зміщення заголовка програми у заголовку ELF і запис PHDR не збігаються"
-#: src/elflint.c:4495
+#: src/elflint.c:4525
#, c-format
msgid "call frame search table reference in program header has wrong offset\n"
msgstr ""
"посилання на таблицю вікон викликів у заголовку програми має помилкове "
"зміщення\n"
-#: src/elflint.c:4498
+#: src/elflint.c:4528
#, c-format
msgid "call frame search table size mismatch in program and section header\n"
msgstr ""
"розміри таблиці пошуку вікон виклику у заголовку програми та у заголовку "
"розділу не збігаються\n"
-#: src/elflint.c:4511
+#: src/elflint.c:4541
#, c-format
msgid "PT_GNU_EH_FRAME present but no .eh_frame_hdr section\n"
msgstr "існує PT_GNU_EH_FRAME, хоча немає розділу .eh_frame_hdr\n"
-#: src/elflint.c:4519
+#: src/elflint.c:4549
#, c-format
msgid "call frame search table must be allocated\n"
msgstr "таблицю пошуку вікон викликів має бути розміщено у пам’яті\n"
-#: src/elflint.c:4522
+#: src/elflint.c:4552
#, c-format
msgid "section [%2zu] '%s' must be allocated\n"
msgstr "розділ [%2zu] «%s» має бути розміщено у пам’яті\n"
-#: src/elflint.c:4526
+#: src/elflint.c:4556
#, c-format
msgid "call frame search table must not be writable\n"
msgstr "таблиця пошуку вікон викликів не повинна бути придатною до запису\n"
-#: src/elflint.c:4529
+#: src/elflint.c:4559
#, c-format
msgid "section [%2zu] '%s' must not be writable\n"
msgstr "розділ [%2zu] «%s» не повинен бути придатним до запису\n"
-#: src/elflint.c:4534
+#: src/elflint.c:4564
#, c-format
msgid "call frame search table must not be executable\n"
msgstr "таблиця пошуку вікон викликів не повинна бути придатною до виконання\n"
-#: src/elflint.c:4537
+#: src/elflint.c:4567
#, c-format
msgid "section [%2zu] '%s' must not be executable\n"
msgstr "розділ [%2zu] «%s» не повинен бути придатним до виконання\n"
-#: src/elflint.c:4548
+#: src/elflint.c:4578
#, c-format
msgid "program header entry %d: file size greater than memory size\n"
msgstr "запис заголовка програми %d: розмір файла перевищує об’єм пам’яті\n"
-#: src/elflint.c:4555
+#: src/elflint.c:4585
#, c-format
msgid "program header entry %d: alignment not a power of 2\n"
msgstr "запис заголовка програми %d: значення вирівнювання не є степенем 2\n"
-#: src/elflint.c:4558
+#: src/elflint.c:4588
#, c-format
msgid ""
"program header entry %d: file offset and virtual address not module of "
@@ -3219,7 +3237,7 @@ msgstr ""
"запис заголовка програми %d: зміщення у файлі і віртуальна адреса не "
"співвідносяться з вирівнюванням\n"
-#: src/elflint.c:4571
+#: src/elflint.c:4601
#, c-format
msgid ""
"executable/DSO with .eh_frame_hdr section does not have a PT_GNU_EH_FRAME "
@@ -3228,12 +3246,12 @@ msgstr ""
"виконуваний модуль/DSO з розділом .eh_frame_hdr не містить запису заголовка "
"програми PT_GNU_EH_FRAME"
-#: src/elflint.c:4605
+#: src/elflint.c:4635
#, c-format
msgid "cannot read ELF header: %s\n"
msgstr "не вдалося прочитати заголовок ELF: %s\n"
-#: src/elflint.c:4631
+#: src/elflint.c:4661
#, c-format
msgid "text relocation flag set but not needed\n"
msgstr ""
@@ -3256,7 +3274,7 @@ msgid "Locate source of text relocations in FILEs (a.out by default)."
msgstr "Шукає джерело пересуваного тексту у ФАЙЛАХ (типово, a.out)."
#: src/findtextrel.c:76 src/nm.c:107 src/objdump.c:71 src/size.c:83
-#: src/strings.c:84 src/strip.c:95
+#: src/strings.c:88 src/strip.c:95
msgid "[FILE...]"
msgstr "[ФАЙЛ...]"
@@ -3291,19 +3309,14 @@ msgid "while reading ELF file"
msgstr "під час спроби читання файла ELF"
#: src/findtextrel.c:329
-#, fuzzy, c-format
+#, c-format
msgid "cannot get program header count: %s"
-msgstr "не вдалося отримати заголовок програми: %s"
+msgstr "не вдалося отримати кількість заголовків програми: %s"
#: src/findtextrel.c:340 src/findtextrel.c:357
-#, fuzzy, c-format
-msgid "cannot get program header index at offset %zd: %s"
-msgstr "не вдалося отримати індекс заголовка програми за зміщенням %d: %s"
-
-#: src/findtextrel.c:409
#, c-format
-msgid "cannot get section header of section %Zu: %s"
-msgstr "не вдалося отримати заголовок розділу %Zu: %s"
+msgid "cannot get program header index at offset %zd: %s"
+msgstr "не вдалося отримати індекс заголовка програми за зміщенням %zd: %s"
#: src/findtextrel.c:421
#, c-format
@@ -4012,7 +4025,7 @@ msgstr "внутрішня помилка: небезбітовий розділ
msgid "cannot get header of 0th section: %s"
msgstr "не вдалося отримати заголовок 0-го розділу: %s"
-#: src/ldgeneric.c:6930 src/unstrip.c:1821
+#: src/ldgeneric.c:6930 src/unstrip.c:1845
#, c-format
msgid "cannot update ELF header: %s"
msgstr "не вдалося оновити заголовок ELF: %s"
@@ -4067,9 +4080,10 @@ msgstr "під час читання скрипту компонування «%
#: src/ldscript.y:737
#, c-format
-msgid "symbol '%s' is declared both local and global for unnamed version"
+msgid "symbol '%s' is declared both local and global for unnamed version '%s'"
msgstr ""
-"символ «%s» оголошено локально і на загальному рівні для версії без назви"
+"символ «%s» оголошено локально і на загальному рівні для версії без назви "
+"«%s»"
#: src/ldscript.y:739
#, c-format
@@ -4174,9 +4188,9 @@ msgid "Output formatting"
msgstr "Форматування виводу"
#: src/nm.c:139 src/objdump.c:103 src/size.c:108 src/strip.c:127
-#, fuzzy, c-format
+#, c-format
msgid "%s: INTERNAL ERROR %d (%s): %s"
-msgstr "%s: ВНУТРІШНЯ ПОМИЛКА %d (%s-%s): %s"
+msgstr "%s: ВНУТРІШНЯ ПОМИЛКА %d (%s): %s"
#: src/nm.c:394 src/nm.c:406 src/size.c:305 src/size.c:314 src/size.c:325
#: src/strip.c:2275
@@ -4226,8 +4240,8 @@ msgstr "не вдалося створити дерево пошуку"
#: src/readelf.c:1085 src/readelf.c:1245 src/readelf.c:1393 src/readelf.c:1579
#: src/readelf.c:1785 src/readelf.c:1975 src/readelf.c:2202 src/readelf.c:2460
#: src/readelf.c:2536 src/readelf.c:2623 src/readelf.c:3203 src/readelf.c:3239
-#: src/readelf.c:3302 src/readelf.c:8211 src/readelf.c:9297 src/readelf.c:9444
-#: src/readelf.c:9512 src/size.c:413 src/size.c:482 src/strip.c:520
+#: src/readelf.c:3302 src/readelf.c:8212 src/readelf.c:9306 src/readelf.c:9453
+#: src/readelf.c:9521 src/size.c:413 src/size.c:482 src/strip.c:520
#, c-format
msgid "cannot get section header string table index"
msgstr "не вдалося визначити індекс заголовка розділу у таблиці рядків"
@@ -4255,14 +4269,14 @@ msgstr ""
"\n"
#: src/nm.c:1171
-#, fuzzy, c-format
+#, c-format
msgid "%s: entry size in section %zd `%s' is not what we expect"
-msgstr "%s: розмір запису у розділі «%s» не є очікуваним"
+msgstr "%s: розмір запису у розділі %zd «%s» не є очікуваним"
#: src/nm.c:1176
-#, fuzzy, c-format
+#, c-format
msgid "%s: size of section %zd `%s' is not multiple of entry size"
-msgstr "%s: розмір розділу «%s» не є кратним до розміру запису"
+msgstr "%s: розмір розділу %zd «%s» не є кратним до розміру запису"
#: src/nm.c:1434
#, c-format
@@ -4494,11 +4508,11 @@ msgstr "не вдалося створити дескриптор Elf: %s"
msgid "cannot get section: %s"
msgstr "не вдалося отримати розділ: %s"
-#: src/readelf.c:554 src/readelf.c:1106 src/readelf.c:1277 src/readelf.c:9464
+#: src/readelf.c:554 src/readelf.c:1106 src/readelf.c:1277 src/readelf.c:9473
#: src/unstrip.c:355 src/unstrip.c:386 src/unstrip.c:435 src/unstrip.c:543
-#: src/unstrip.c:560 src/unstrip.c:596 src/unstrip.c:794 src/unstrip.c:1062
-#: src/unstrip.c:1253 src/unstrip.c:1313 src/unstrip.c:1434 src/unstrip.c:1487
-#: src/unstrip.c:1594 src/unstrip.c:1783
+#: src/unstrip.c:560 src/unstrip.c:596 src/unstrip.c:794 src/unstrip.c:1078
+#: src/unstrip.c:1269 src/unstrip.c:1329 src/unstrip.c:1450 src/unstrip.c:1503
+#: src/unstrip.c:1618 src/unstrip.c:1807
#, c-format
msgid "cannot get section header: %s"
msgstr "не вдалося отримати заголовок розділу: %s"
@@ -4509,7 +4523,7 @@ msgid "cannot get section name"
msgstr "не вдалося отримати назву розділу"
#: src/readelf.c:571 src/readelf.c:5396 src/readelf.c:7670 src/readelf.c:7772
-#: src/readelf.c:7948
+#: src/readelf.c:7949
#, c-format
msgid "cannot get %s content: %s"
msgstr "не вдалося отримати дані %s: %s"
@@ -4811,7 +4825,7 @@ msgstr ""
" Відображення розділів на сегмент:\n"
" Розділи сегмента..."
-#: src/readelf.c:1258 src/unstrip.c:1842 src/unstrip.c:1885 src/unstrip.c:1892
+#: src/readelf.c:1258 src/unstrip.c:1866 src/unstrip.c:1909 src/unstrip.c:1916
#, c-format
msgid "cannot get program header: %s"
msgstr "не вдалося отримати заголовок програми: %s"
@@ -4862,9 +4876,9 @@ msgstr "<НЕКОРЕКТНИЙ РОЗДІЛ>"
#: src/readelf.c:1585 src/readelf.c:2208 src/readelf.c:2466 src/readelf.c:2542
#: src/readelf.c:2846 src/readelf.c:2920 src/readelf.c:4608
-#, fuzzy, c-format
-msgid "invalid sh_link value in section %Zu"
-msgstr "некоректне значення sh_link у розділі %Zu"
+#, c-format
+msgid "invalid sh_link value in section %zu"
+msgstr "некоректне значення sh_link у розділі %zu"
#: src/readelf.c:1588
#, c-format
@@ -5198,19 +5212,19 @@ msgid "cannot get data for section %d: %s"
msgstr "не вдалося отримати дані для розділу %d: %s"
#: src/readelf.c:2995
-#, fuzzy, c-format
+#, c-format
msgid "invalid data in sysv.hash section %d"
-msgstr "некоректні дані у розділі [%zu] «%s»"
+msgstr "некоректні дані у розділі sysv.hash %d"
#: src/readelf.c:3050
-#, fuzzy, c-format
+#, c-format
msgid "invalid data in sysv.hash64 section %d"
-msgstr "некоректні дані у розділі [%zu] «%s»"
+msgstr "некоректні дані у розділі sysv.hash64 %d"
#: src/readelf.c:3108
-#, fuzzy, c-format
+#, c-format
msgid "invalid data in gnu.hash section %d"
-msgstr "некоректні дані у розділі [%zu] «%s»"
+msgstr "некоректні дані у розділі gnu.hash %d"
#: src/readelf.c:3175
#, c-format
@@ -5483,10 +5497,10 @@ msgstr ""
#, c-format
msgid ""
"\n"
-"Table at offset %Zu:\n"
+"Table at offset %zu:\n"
msgstr ""
"\n"
-"Таблиця за зміщенням %Zu:\n"
+"Таблиця за зміщенням %zu:\n"
#: src/readelf.c:4693 src/readelf.c:5430 src/readelf.c:6397
#, c-format
@@ -5553,8 +5567,8 @@ msgstr " %s..%s\n"
#: src/readelf.c:4807
#, c-format
-msgid " %Zu padding bytes\n"
-msgstr " %Zu байтів доповнення\n"
+msgid " %zu padding bytes\n"
+msgstr " %zu байтів доповнення\n"
#: src/readelf.c:4825
#, c-format
@@ -5587,9 +5601,8 @@ msgid " %s..%s\n"
msgstr " %s..%s\n"
#: src/readelf.c:5076
-#, fuzzy
msgid " <INVALID DATA>\n"
-msgstr " <НЕКОРЕКТНІ ДАНІ>\n"
+msgstr " <НЕКОРЕКТНІ ДАНІ>\n"
#: src/readelf.c:5385
#, c-format
@@ -5803,9 +5816,9 @@ msgstr ""
"Оператори номерів рядків:"
#: src/readelf.c:6589
-#, fuzzy, c-format
+#, c-format
msgid "invalid maximum operations per instruction is zero"
-msgstr "некоректна мінімальна довжина розмірності рядка для порівняння"
+msgstr "некоректну кількість операцій на інструкцію прирівняно до нуля"
#: src/readelf.c:6625
#, c-format
@@ -5953,9 +5966,9 @@ msgid "%*s*** non-terminated string at end of section"
msgstr "%*s*** незавершений рядок наприкінці розділу"
#: src/readelf.c:7126
-#, fuzzy, c-format
+#, c-format
msgid "%*s*** missing DW_MACINFO_start_file argument at end of section"
-msgstr "%*s*** незавершений рядок наприкінці розділу"
+msgstr "%*s*** пропущено аргумент DW_MACINFO_start_file наприкінці розділу"
#: src/readelf.c:7226
#, c-format
@@ -5967,7 +5980,7 @@ msgstr " Зміщення: 0x%<PRIx64>\n"
msgid " Version: %<PRIu16>\n"
msgstr " Версія: %<PRIu16>\n"
-#: src/readelf.c:7244 src/readelf.c:7977
+#: src/readelf.c:7244 src/readelf.c:7978
#, c-format
msgid " unknown version, cannot parse section\n"
msgstr " невідома версія, не вдалося обробити розділ\n"
@@ -6088,12 +6101,12 @@ msgstr ""
" Місце застосування: %#<PRIx64>\n"
" Дія: %u\n"
-#: src/readelf.c:7913
+#: src/readelf.c:7914
#, c-format
msgid "invalid TType encoding"
msgstr "некоректне кодування TType"
-#: src/readelf.c:7939
+#: src/readelf.c:7940
#, c-format
msgid ""
"\n"
@@ -6102,37 +6115,37 @@ msgstr ""
"\n"
"Розділ GDB [%2zu] «%s» за зміщенням %#<PRIx64> містить %<PRId64> байтів:\n"
-#: src/readelf.c:7968
+#: src/readelf.c:7969
#, c-format
msgid " Version: %<PRId32>\n"
msgstr " Версія: %<PRId32>\n"
-#: src/readelf.c:7986
+#: src/readelf.c:7987
#, c-format
msgid " CU offset: %#<PRIx32>\n"
msgstr " зміщення CU: %#<PRIx32>\n"
-#: src/readelf.c:7993
+#: src/readelf.c:7994
#, c-format
msgid " TU offset: %#<PRIx32>\n"
msgstr " зміщення TU: %#<PRIx32>\n"
-#: src/readelf.c:8000
+#: src/readelf.c:8001
#, c-format
msgid " address offset: %#<PRIx32>\n"
msgstr " зміщення адреси: %#<PRIx32>\n"
-#: src/readelf.c:8007
+#: src/readelf.c:8008
#, c-format
msgid " symbol offset: %#<PRIx32>\n"
msgstr " зміщення символу: %#<PRIx32>\n"
-#: src/readelf.c:8014
+#: src/readelf.c:8015
#, c-format
msgid " constant offset: %#<PRIx32>\n"
msgstr " стале зміщення: %#<PRIx32>\n"
-#: src/readelf.c:8028
+#: src/readelf.c:8029
#, c-format
msgid ""
"\n"
@@ -6141,7 +6154,7 @@ msgstr ""
"\n"
" Список CU зі зміщенням %#<PRIx32> містить %zu записів:\n"
-#: src/readelf.c:8053
+#: src/readelf.c:8054
#, c-format
msgid ""
"\n"
@@ -6150,7 +6163,7 @@ msgstr ""
"\n"
" Список TU зі зміщенням %#<PRIx32> містить %zu записів:\n"
-#: src/readelf.c:8082
+#: src/readelf.c:8083
#, c-format
msgid ""
"\n"
@@ -6159,7 +6172,7 @@ msgstr ""
"\n"
" Список адрес зі зміщенням %#<PRIx32> містить %zu записів:\n"
-#: src/readelf.c:8115
+#: src/readelf.c:8116
#, c-format
msgid ""
"\n"
@@ -6168,17 +6181,17 @@ msgstr ""
"\n"
" Таблиця символів за зміщенням %#<PRIx32> містить %zu позицій:\n"
-#: src/readelf.c:8202
+#: src/readelf.c:8203
#, c-format
msgid "cannot get debug context descriptor: %s"
msgstr "не вдалося отримати дескриптор контексту зневаджування: %s"
-#: src/readelf.c:8360 src/readelf.c:8966 src/readelf.c:9077 src/readelf.c:9135
+#: src/readelf.c:8361 src/readelf.c:8975 src/readelf.c:9086 src/readelf.c:9144
#, c-format
msgid "cannot convert core note data: %s"
msgstr "не вдалося перетворити дані запису ядра: %s"
-#: src/readelf.c:8707
+#: src/readelf.c:8716
#, c-format
msgid ""
"\n"
@@ -6187,21 +6200,21 @@ msgstr ""
"\n"
"%*s... <повторюється %u разів> ..."
-#: src/readelf.c:9214
+#: src/readelf.c:9223
msgid " Owner Data size Type\n"
msgstr " Власник Розм. даних Тип\n"
-#: src/readelf.c:9232
+#: src/readelf.c:9241
#, c-format
msgid " %-13.*s %9<PRId32> %s\n"
msgstr " %-13.*s %9<PRId32> %s\n"
-#: src/readelf.c:9282
+#: src/readelf.c:9291
#, c-format
msgid "cannot get content of note section: %s"
msgstr "не вдалося отримати вміст розділу записів: %s"
-#: src/readelf.c:9309
+#: src/readelf.c:9318
#, c-format
msgid ""
"\n"
@@ -6211,7 +6224,7 @@ msgstr ""
"Розділ записів (note) [%2zu] «%s» з %<PRIu64> байтів за зміщенням "
"%#0<PRIx64>:\n"
-#: src/readelf.c:9332
+#: src/readelf.c:9341
#, c-format
msgid ""
"\n"
@@ -6220,48 +6233,48 @@ msgstr ""
"\n"
"Сегмент записів з %<PRIu64> байтів за зміщенням %#0<PRIx64>:\n"
-#: src/readelf.c:9378
+#: src/readelf.c:9387
#, c-format
msgid ""
"\n"
-"Section [%Zu] '%s' has no data to dump.\n"
+"Section [%zu] '%s' has no data to dump.\n"
msgstr ""
"\n"
-"У розділі [%Zu] «%s» не міститься даних для створення дампу.\n"
+"У розділі [%zu] «%s» не міститься даних для створення дампу.\n"
-#: src/readelf.c:9384 src/readelf.c:9407
+#: src/readelf.c:9393 src/readelf.c:9416
#, c-format
-msgid "cannot get data for section [%Zu] '%s': %s"
-msgstr "не вдалося отримати дані для розділу [%Zu] «%s»: %s"
+msgid "cannot get data for section [%zu] '%s': %s"
+msgstr "не вдалося отримати дані для розділу [%zu] «%s»: %s"
-#: src/readelf.c:9388
+#: src/readelf.c:9397
#, c-format
msgid ""
"\n"
-"Hex dump of section [%Zu] '%s', %<PRIu64> bytes at offset %#0<PRIx64>:\n"
+"Hex dump of section [%zu] '%s', %<PRIu64> bytes at offset %#0<PRIx64>:\n"
msgstr ""
"\n"
-"Шіст. дамп розділу [%Zu] «%s», %<PRIu64> байтів за зміщенням %#0<PRIx64>:\n"
+"Шіст. дамп розділу [%zu] «%s», %<PRIu64> байтів за зміщенням %#0<PRIx64>:\n"
-#: src/readelf.c:9401
+#: src/readelf.c:9410
#, c-format
msgid ""
"\n"
-"Section [%Zu] '%s' has no strings to dump.\n"
+"Section [%zu] '%s' has no strings to dump.\n"
msgstr ""
"\n"
-"У розділі [%Zu] «%s» не міститься рядків для створення дампу.\n"
+"У розділі [%zu] «%s» не міститься рядків для створення дампу.\n"
-#: src/readelf.c:9411
+#: src/readelf.c:9420
#, c-format
msgid ""
"\n"
-"String section [%Zu] '%s' contains %<PRIu64> bytes at offset %#0<PRIx64>:\n"
+"String section [%zu] '%s' contains %<PRIu64> bytes at offset %#0<PRIx64>:\n"
msgstr ""
"\n"
-"Розділ рядків [%Zu] «%s» містить %<PRIu64> байтів за зміщенням %#0<PRIx64>:\n"
+"Розділ рядків [%zu] «%s» містить %<PRIu64> байтів за зміщенням %#0<PRIx64>:\n"
-#: src/readelf.c:9459
+#: src/readelf.c:9468
#, c-format
msgid ""
"\n"
@@ -6270,7 +6283,7 @@ msgstr ""
"\n"
"розділу [%lu] не існує"
-#: src/readelf.c:9488
+#: src/readelf.c:9497
#, c-format
msgid ""
"\n"
@@ -6279,12 +6292,12 @@ msgstr ""
"\n"
"розділу «%s» не існує"
-#: src/readelf.c:9545
+#: src/readelf.c:9554
#, c-format
msgid "cannot get symbol index of archive '%s': %s"
msgstr "не вдалося отримати покажчик символів архіву «%s»: %s"
-#: src/readelf.c:9548
+#: src/readelf.c:9557
#, c-format
msgid ""
"\n"
@@ -6293,21 +6306,21 @@ msgstr ""
"\n"
"У архіві «%s» немає покажчика символів\n"
-#: src/readelf.c:9552
+#: src/readelf.c:9561
#, c-format
msgid ""
"\n"
-"Index of archive '%s' has %Zu entries:\n"
+"Index of archive '%s' has %zu entries:\n"
msgstr ""
"\n"
-"Покажчик архіву «%s» містить %Zu записів:\n"
+"Покажчик архіву «%s» містить %zu записів:\n"
-#: src/readelf.c:9570
+#: src/readelf.c:9579
#, c-format
-msgid "cannot extract member at offset %Zu in '%s': %s"
-msgstr "не вдалося видобути елемент за зміщенням %Zu у «%s»: %s"
+msgid "cannot extract member at offset %zu in '%s': %s"
+msgstr "не вдалося видобути елемент за зміщенням %zu у «%s»: %s"
-#: src/readelf.c:9575
+#: src/readelf.c:9584
#, c-format
msgid "Archive member '%s' contains:\n"
msgstr "Елемент архіву «%s» містить:\n"
@@ -6385,103 +6398,111 @@ msgstr "(ЗАГАЛОМ)\n"
#: src/stack.c:488
#, c-format
msgid "-p PID should be a positive process id."
-msgstr ""
+msgstr "PID у -p PID має бути додатним значенням ідентифікатора процесу."
#: src/stack.c:494
-#, fuzzy, c-format
+#, c-format
msgid "Cannot open core file '%s'"
-msgstr "не вдалося відкрити архів «%s»"
+msgstr "Не вдалося відкрити файл дампу ядра «%s»"
#: src/stack.c:554
#, c-format
msgid "-n MAXFRAMES should be 0 or higher."
-msgstr ""
+msgstr "MAXFRAMES у -n має бути значенням рівним 0 або більшим."
#: src/stack.c:566
#, c-format
msgid "-e EXEC needs a core given by --core."
-msgstr ""
+msgstr "Для -e EXEC слід вказати ядро за допомогою --core."
#: src/stack.c:570
#, c-format
msgid "-1 needs a thread id given by -p."
-msgstr ""
+msgstr "-1 слід передати ідентифікатор потоку виконання, заданого -p."
#: src/stack.c:574
#, c-format
msgid "One of -p PID or --core COREFILE should be given."
-msgstr ""
+msgstr "Слід вказати -p PID або --core COREFILE."
#: src/stack.c:644
-#, fuzzy
msgid "Show stack of process PID"
-msgstr "не вдалося створити дерево пошуку"
+msgstr "Вивести стек PID процесу"
#: src/stack.c:646
msgid "Show stack found in COREFILE"
-msgstr ""
+msgstr "Вивести стек, знайдений у COREFILE"
#: src/stack.c:647
msgid "(optional) EXECUTABLE that produced COREFILE"
-msgstr ""
+msgstr "(необов’язковий) EXECUTABLE, яким створено COREFILE"
#: src/stack.c:651
msgid "Output selection options:"
msgstr "Параметри вибору виведених даних:"
#: src/stack.c:653
-#, fuzzy
msgid "Additionally show frame activation"
-msgstr "Додатковий вибір виводу:"
+msgstr "Додатково вивести активацію вікна"
#: src/stack.c:655
msgid "Additionally try to lookup DWARF debuginfo name for frame address"
msgstr ""
+"Додатково спробувати визначити назву файла даних діагностики DWARF для "
+"адреси вікна"
#: src/stack.c:658
msgid ""
"Additionally show inlined function frames using DWARF debuginfo if available "
"(implies -d)"
msgstr ""
+"Додатково вивести вікна вбудованих функцій за допомогою даних діагностики "
+"DWARF, якщо такі є (використовується і -d)"
#: src/stack.c:660
msgid "Additionally show module file information"
-msgstr ""
+msgstr "Додатково вивести дані щодо файла модуля"
#: src/stack.c:662
-#, fuzzy
msgid "Additionally show source file information"
-msgstr "Додатковий вибір виводу:"
+msgstr "Додатково вивести дані щодо файла початкового коду"
#: src/stack.c:664
msgid ""
"Show all additional information (activation, debugname, inlines, module and "
"source)"
msgstr ""
+"Вивести усі додаткові дані (активацію, назву у системі діагностики, "
+"вбудовані функції, модуль і початковий файл)"
#: src/stack.c:666
msgid "Do not resolve address to function symbol name"
-msgstr ""
+msgstr "Не розгортати адресу до назви символу функції"
#: src/stack.c:668
msgid "Show raw function symbol names, do not try to demangle names"
msgstr ""
+"Вивести назви символів функцій без обробки, не намагатися розшифрувати назви"
#: src/stack.c:670
msgid "Show module build-id, load address and pc offset"
-msgstr ""
+msgstr "Виводити ідентифікатор збирання, адресу завантаження та зсув модуля"
#: src/stack.c:672
msgid "Show the backtrace of only one thread"
-msgstr ""
+msgstr "Виводити зворотне трасування лише одного потоку"
#: src/stack.c:674
msgid "Show at most MAXFRAMES per thread (default 256, use 0 for unlimited)"
msgstr ""
+"Виводити не більше MAXFRAMES на потік виконання (типове значення 256, 0 — не "
+"обмежувати)"
#: src/stack.c:676
msgid "Show module memory map with build-id, elf and debug files detected"
msgstr ""
+"Вивести карту пам’яті модуля із виявленими ідентифікатором збирання, elf та "
+"файлами діагностичних даних"
#: src/stack.c:684
msgid ""
@@ -6493,27 +6514,35 @@ msgid ""
"2. If the program was invoked with bad or missing arguments it will exit "
"with return code 64."
msgstr ""
+"Вивести стек для кожного потоку у процесі або файлі дампу ядра.\vПрограма "
+"завершує роботу з кодом виходу 0, якщо усі вікна було виведено без помилок. "
+"Якщо деякі вікна було показано, але сталися некритичні помилки, ймовірно "
+"спричинені неповними даними зворотного трасування, програма завершує роботу "
+"з кодом повернення 1. Якщо не вдалося вивести жодного вікна або сталася "
+"критична помилка, програма виходить з кодом повернення 2. Якщо програму було "
+"викликано з помилковими або пропущеними аргументами, програма завершить "
+"роботу з кодом виходу 64."
#: src/stack.c:757
#, c-format
msgid "Couldn't show any frames."
-msgstr ""
+msgstr "Не вдалося вивести жодного вікна."
-#: src/strings.c:62
+#: src/strings.c:66
msgid "Output Selection:"
msgstr "Вибір виводу:"
-#: src/strings.c:63
+#: src/strings.c:67
msgid "Scan entire file, not only loaded sections"
msgstr "Шукати у всьому файлі, а не лише у завантажених розділах"
-#: src/strings.c:65
+#: src/strings.c:69
msgid "Only NUL-terminated sequences of MIN-LEN characters or more are printed"
msgstr ""
"Буде виведено лише послідовності з не менше, ніж MIN-LEN символів, що "
"завершуються на NUL"
-#: src/strings.c:66
+#: src/strings.c:70
msgid ""
"Select character size and endianess: s = 7-bit, S = 8-bit, {b,l} = 16-bit, "
"{B,L} = 32-bit"
@@ -6521,51 +6550,51 @@ msgstr ""
"Визначення розмірності та порядку бітів символів: s = 7-бітові, S = 8-"
"бітові, {b,l} = 16-бітові, {B,L} = 32-бітові"
-#: src/strings.c:70
+#: src/strings.c:74
msgid "Print name of the file before each string."
msgstr "Виводити назву файла перед кожним рядком."
-#: src/strings.c:72
+#: src/strings.c:76
msgid "Print location of the string in base 8, 10, or 16 respectively."
msgstr "Виводити адресу рядка за основами 8, 10 та 16, відповідно."
-#: src/strings.c:73
+#: src/strings.c:77
msgid "Alias for --radix=o"
msgstr "Замінник --radix=o"
-#: src/strings.c:80
+#: src/strings.c:84
msgid "Print the strings of printable characters in files."
msgstr "Вивести рядки файлів з символів, придатних для друку."
-#: src/strings.c:267 src/strings.c:302
+#: src/strings.c:271 src/strings.c:306
#, c-format
msgid "invalid value '%s' for %s parameter"
msgstr "некоректне значення «%s» параметра %s"
-#: src/strings.c:313
+#: src/strings.c:317
#, c-format
msgid "invalid minimum length of matched string size"
msgstr "некоректна мінімальна довжина розмірності рядка для порівняння"
-#: src/strings.c:596
+#: src/strings.c:600
#, c-format
msgid "lseek64 failed"
msgstr "помилка lseek64"
-#: src/strings.c:613 src/strings.c:677
+#: src/strings.c:617 src/strings.c:681
#, c-format
msgid "re-mmap failed"
msgstr "помилка повторного використання mmap"
-#: src/strings.c:650
+#: src/strings.c:654
#, c-format
msgid "mprotect failed"
msgstr "помилка mprotect"
-#: src/strings.c:739
+#: src/strings.c:743
#, c-format
msgid "Skipping section %zd '%s' data outside file"
-msgstr ""
+msgstr "Пропускаємо дані %zd «%s» поза файлом"
#: src/strip.c:68
msgid "Place stripped output into FILE"
@@ -6663,11 +6692,9 @@ msgstr ""
"архіву"
#: src/strip.c:384
-#, fuzzy, c-format
+#, c-format
msgid "%s: no support for stripping archive"
-msgstr ""
-"%s: не можна використовувати -o або -f під час вилучення додаткового вмісту "
-"архіву"
+msgstr "%s: підтримки вилучення додаткового вмісту з архіву не передбачено"
#: src/strip.c:483
#, c-format
@@ -6675,9 +6702,9 @@ msgid "cannot open EBL backend"
msgstr "не вдалося відкрити канал сервера EBL"
#: src/strip.c:528
-#, fuzzy, c-format
+#, c-format
msgid "cannot get number of phdrs"
-msgstr "не вдалося визначити кількість заголовків програми: %s"
+msgstr "не вдалося отримати кількість phdr"
#: src/strip.c:544 src/strip.c:568
#, c-format
@@ -6847,12 +6874,12 @@ msgstr "не вдалося створити заголовок ELF: %s"
msgid "cannot copy ELF header: %s"
msgstr "не вдалося скопіювати заголовок ELF: %s"
-#: src/unstrip.c:261 src/unstrip.c:1831 src/unstrip.c:1875
-#, fuzzy, c-format
+#: src/unstrip.c:261 src/unstrip.c:1855 src/unstrip.c:1899
+#, c-format
msgid "cannot get number of program headers: %s"
-msgstr "не вдалося визначити кількість заголовків програми: %s"
+msgstr "не вдалося отримати кількість заголовків програми: %s"
-#: src/unstrip.c:266 src/unstrip.c:1835
+#: src/unstrip.c:266 src/unstrip.c:1859
#, c-format
msgid "cannot create program headers: %s"
msgstr "не вдалося створити заголовки програми: %s"
@@ -6867,12 +6894,12 @@ msgstr "не вдалося скопіювати заголовок програ
msgid "cannot copy section header: %s"
msgstr "не вдалося скопіювати заголовок розділу: %s"
-#: src/unstrip.c:285 src/unstrip.c:1512
+#: src/unstrip.c:285 src/unstrip.c:1536
#, c-format
msgid "cannot get section data: %s"
msgstr "не вдалося отримати дані розділу: %s"
-#: src/unstrip.c:287 src/unstrip.c:1514
+#: src/unstrip.c:287 src/unstrip.c:1538
#, c-format
msgid "cannot copy section data: %s"
msgstr "не вдалося скопіювати дані розділу: %s"
@@ -6882,13 +6909,13 @@ msgstr "не вдалося скопіювати дані розділу: %s"
msgid "cannot create directory '%s'"
msgstr "не вдалося створити каталог «%s»"
-#: src/unstrip.c:351 src/unstrip.c:768 src/unstrip.c:1546
+#: src/unstrip.c:351 src/unstrip.c:768 src/unstrip.c:1570
#, c-format
msgid "cannot get symbol table entry: %s"
msgstr "не вдалося отримати запис таблиці символів: %s"
#: src/unstrip.c:367 src/unstrip.c:585 src/unstrip.c:606 src/unstrip.c:618
-#: src/unstrip.c:1567 src/unstrip.c:1697 src/unstrip.c:1721
+#: src/unstrip.c:1591 src/unstrip.c:1721 src/unstrip.c:1745
#, c-format
msgid "cannot update symbol table: %s"
msgstr "не вдалося оновити таблицю символів: %s"
@@ -6910,105 +6937,105 @@ msgstr "не вдалося отримати версію символу: %s"
#: src/unstrip.c:526
#, c-format
-msgid "unexpected section type in [%Zu] with sh_link to symtab"
-msgstr "неочікуваний тип розділу у [%Zu] з посиланням sh_link на symtab"
+msgid "unexpected section type in [%zu] with sh_link to symtab"
+msgstr "неочікуваний тип розділу у [%zu] з посиланням sh_link на symtab"
#: src/unstrip.c:774
#, c-format
-msgid "invalid string offset in symbol [%Zu]"
-msgstr "некоректне зміщення рядка у символі [%Zu]"
+msgid "invalid string offset in symbol [%zu]"
+msgstr "некоректне зміщення рядка у символі [%zu]"
-#: src/unstrip.c:916 src/unstrip.c:1257
+#: src/unstrip.c:932 src/unstrip.c:1273
#, c-format
-msgid "cannot read section [%Zu] name: %s"
-msgstr "не вдалося прочитати назву розділу [%Zu]: %s"
+msgid "cannot read section [%zu] name: %s"
+msgstr "не вдалося прочитати назву розділу [%zu]: %s"
-#: src/unstrip.c:957 src/unstrip.c:976 src/unstrip.c:1009
+#: src/unstrip.c:973 src/unstrip.c:992 src/unstrip.c:1025
#, c-format
msgid "cannot read '.gnu.prelink_undo' section: %s"
msgstr "не вдалося прочитати розділ «.gnu.prelink_undo»: %s"
-#: src/unstrip.c:997
+#: src/unstrip.c:1013
#, c-format
msgid "invalid contents in '%s' section"
msgstr "некоректний вміст розділу «%s»"
-#: src/unstrip.c:1052 src/unstrip.c:1377
+#: src/unstrip.c:1068 src/unstrip.c:1393
#, c-format
-msgid "cannot find matching section for [%Zu] '%s'"
-msgstr "не вдалося знайти відповідний розділ для [%Zu] «%s»"
+msgid "cannot find matching section for [%zu] '%s'"
+msgstr "не вдалося знайти відповідний розділ для [%zu] «%s»"
-#: src/unstrip.c:1177 src/unstrip.c:1192 src/unstrip.c:1458
+#: src/unstrip.c:1193 src/unstrip.c:1208 src/unstrip.c:1474
#, c-format
msgid "cannot add section name to string table: %s"
msgstr "не вдалося додати назву розділу до таблиці рядків: %s"
-#: src/unstrip.c:1201
+#: src/unstrip.c:1217
#, c-format
msgid "cannot update section header string table data: %s"
msgstr "не вдалося оновити дані заголовка розділу у таблиці рядків: %s"
-#: src/unstrip.c:1228 src/unstrip.c:1232
+#: src/unstrip.c:1244 src/unstrip.c:1248
#, c-format
msgid "cannot get section header string table section index: %s"
msgstr ""
"не вдалося визначити індекс розділу заголовка розділу у таблиці рядків: %s"
-#: src/unstrip.c:1236 src/unstrip.c:1240 src/unstrip.c:1473
+#: src/unstrip.c:1252 src/unstrip.c:1256 src/unstrip.c:1489
#, c-format
msgid "cannot get section count: %s"
msgstr "не вдалося отримати кількість розділів: %s"
-#: src/unstrip.c:1243
+#: src/unstrip.c:1259
#, c-format
msgid "more sections in stripped file than debug file -- arguments reversed?"
msgstr ""
"у очищеному файлі більше розділів ніж у файлі з даними для зневаджування — "
"помилковий порядок параметрів?"
-#: src/unstrip.c:1302 src/unstrip.c:1392
+#: src/unstrip.c:1318 src/unstrip.c:1408
#, c-format
msgid "cannot read section header string table: %s"
msgstr "не вдалося прочитати таблицю рядків заголовка розділу: %s"
-#: src/unstrip.c:1452
+#: src/unstrip.c:1468
#, c-format
msgid "cannot add new section: %s"
msgstr "не вдалося додати новий розділ: %s"
-#: src/unstrip.c:1554
+#: src/unstrip.c:1578
#, c-format
-msgid "symbol [%Zu] has invalid section index"
-msgstr "символ [%Zu] має некоректний індекс розділу"
+msgid "symbol [%zu] has invalid section index"
+msgstr "символ [%zu] має некоректний індекс розділу"
-#: src/unstrip.c:1792
+#: src/unstrip.c:1816
#, c-format
msgid "cannot read section data: %s"
msgstr "не вдалося прочитати дані розділу: %s"
-#: src/unstrip.c:1813
+#: src/unstrip.c:1837
#, c-format
msgid "cannot get ELF header: %s"
msgstr "не вдалося отримати заголовок ELF: %s"
-#: src/unstrip.c:1845
+#: src/unstrip.c:1869
#, c-format
msgid "cannot update program header: %s"
msgstr "не вдалося оновити заголовок програми: %s"
-#: src/unstrip.c:1850 src/unstrip.c:1933
+#: src/unstrip.c:1874 src/unstrip.c:1957
#, c-format
msgid "cannot write output file: %s"
msgstr "не вдалося записати файл виведених даних: %s"
-#: src/unstrip.c:1902
+#: src/unstrip.c:1926
#, c-format
msgid "DWARF data not adjusted for prelinking bias; consider prelink -u"
msgstr ""
"Дані DWARF не скориговано відповідно до відхилення перед компонуванням; "
"спробуйте виправити це командою prelink -u"
-#: src/unstrip.c:1905
+#: src/unstrip.c:1929
#, c-format
msgid ""
"DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"
@@ -7016,76 +7043,76 @@ msgstr ""
"Дані DWARF у «%s» не скориговано відповідно до відхилення перед "
"компонуванням; спробуйте виправити це командою prelink -u"
-#: src/unstrip.c:1924 src/unstrip.c:1975 src/unstrip.c:1987 src/unstrip.c:2073
+#: src/unstrip.c:1948 src/unstrip.c:1999 src/unstrip.c:2011 src/unstrip.c:2097
#, c-format
msgid "cannot create ELF descriptor: %s"
msgstr "не вдалося створити дескриптор ELF: %s"
-#: src/unstrip.c:1966
+#: src/unstrip.c:1990
msgid "WARNING: "
msgstr "УВАГА: "
-#: src/unstrip.c:1968
+#: src/unstrip.c:1992
msgid ", use --force"
msgstr ", скористайтеся --force"
-#: src/unstrip.c:1991
+#: src/unstrip.c:2015
msgid "ELF header identification (e_ident) different"
msgstr "Різні ідентифікатори заголовків ELF (e_ident)"
-#: src/unstrip.c:1994
+#: src/unstrip.c:2018
msgid "ELF header type (e_type) different"
msgstr "Різні типи заголовків ELF (e_type)"
-#: src/unstrip.c:1997
+#: src/unstrip.c:2021
msgid "ELF header machine type (e_machine) different"
msgstr "Різні типи архітектур заголовків ELF (e_machine)"
-#: src/unstrip.c:2000
+#: src/unstrip.c:2024
msgid "stripped program header (e_phnum) smaller than unstripped"
msgstr "очищений заголовок програми (e_phnum) є меншим за неочищений"
-#: src/unstrip.c:2030
+#: src/unstrip.c:2054
#, c-format
msgid "cannot find stripped file for module '%s': %s"
msgstr "не вдалося знайти очищений файл для модуля «%s»: %s"
-#: src/unstrip.c:2034
+#: src/unstrip.c:2058
#, c-format
msgid "cannot open stripped file '%s' for module '%s': %s"
msgstr "не вдалося відкрити очищений файл «%s» для модуля «%s»: %s"
-#: src/unstrip.c:2049
+#: src/unstrip.c:2073
#, c-format
msgid "cannot find debug file for module '%s': %s"
msgstr "не вдалося знайти файл діагностичних даних для модуля «%s»: %s"
-#: src/unstrip.c:2053
+#: src/unstrip.c:2077
#, c-format
msgid "cannot open debug file '%s' for module '%s': %s"
msgstr "не вдалося відкрити файл діагностичних даних «%s» для модуля «%s»: %s"
-#: src/unstrip.c:2066
+#: src/unstrip.c:2090
#, c-format
msgid "module '%s' file '%s' is not stripped"
msgstr "у модулі «%s» файл «%s» не очищено strip"
-#: src/unstrip.c:2097
+#: src/unstrip.c:2121
#, c-format
msgid "cannot cache section addresses for module '%s': %s"
msgstr "не вдалося кешувати адреси розділів для модуля «%s»: %s"
-#: src/unstrip.c:2230
+#: src/unstrip.c:2254
#, c-format
msgid "no matching modules found"
msgstr "відповідних модулів не виявлено"
-#: src/unstrip.c:2239
+#: src/unstrip.c:2263
#, c-format
msgid "matched more than one module"
msgstr "встановлено відповідність декількох модулів"
-#: src/unstrip.c:2283
+#: src/unstrip.c:2307
msgid ""
"STRIPPED-FILE DEBUG-FILE\n"
"[MODULE...]"
@@ -7093,7 +7120,7 @@ msgstr ""
"ОЧИЩЕНИЙ-ФАЙЛ ФАЙЛ-DEBUG\n"
"[МОДУЛЬ...]"
-#: src/unstrip.c:2284
+#: src/unstrip.c:2308
msgid ""
"Combine stripped files with separate symbols and debug information.\vThe "
"first form puts the result in DEBUG-FILE if -o was not given.\n"
@@ -7149,18 +7176,20 @@ msgstr ""
"окремого файла діагностичних даних або «-», якщо файла діагностичних даних "
"не вдалося знайти, і «.», якщо ФАЙЛ сам містить діагностичні дані."
-#: tests/backtrace.c:425
+#: tests/backtrace.c:427
msgid "Run executable"
-msgstr ""
+msgstr "Запустити виконуваний файл"
#: tests/dwflmodtest.c:213
-#, fuzzy
msgid "Additionally show function names"
-msgstr "Показувати також назви функцій"
+msgstr "Додатково вивести назви функцій"
#: tests/dwflmodtest.c:214
msgid "Show instances of inlined functions"
-msgstr ""
+msgstr "Вивести екземпляри вбудованих функцій"
+
+#~ msgid "cannot get section header of section %Zu: %s"
+#~ msgstr "не вдалося отримати заголовок розділу %Zu: %s"
#, fuzzy
#~ msgid "cannot attach to core"
--
1.8.3.1
8 years, 6 months