Addresses this warning:
[ 67%] Building C object CMakeFiles/scncopy.dir/elfcreator.c.o
/home/acme/git/pahole/elfcreator.c: In function ‘rel_dyn_fixup_fn’:
/home/acme/git/pahole/elfcreator.c:229:3: error: ‘idx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
229 | gelf_update_dyn(ctor->dyndata, idx, dyn);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/acme/git/pahole/elfcreator.c: In function ‘rela_dyn_fixup_fn’:
/home/acme/git/pahole/elfcreator.c:208:3: error: ‘idx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
208 | gelf_update_dyn(ctor->dyndata, idx, dyn);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/acme/git/pahole/elfcreator.c: In function ‘elfcreator_end’:
/home/acme/git/pahole/elfcreator.c:192:3: error: ‘idx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
192 | gelf_update_dyn(ctor->dyndata, idx, dyn);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/acme/git/pahole/elfcreator.c:186:9: note: ‘idx’ was declared here
186 | size_t idx;
| ^~~
cc1: all warnings being treated as errors
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Addresses:
[ 84%] Building C object CMakeFiles/scncopy.dir/elfcreator.c.o
/home/acme/git/pahole/elfcreator.c: In function ‘elfcreator_begin’:
/home/acme/git/pahole/elfcreator.c:57:12: error: variable ‘machine’ set but not used [-Werror=unused-but-set-variable]
GElf_Half machine;
^~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This adds scncopy, which is like objcopy with some differences:
- it doesn't try to update section contents, but does try to
update program headers and such to correctly reflect the section
contents.
- it doesn't necessarily try to create a binary eu-elflint will like.
If you don't copy a required section, it won't make it for you.
TODO:
- Make it possible to copy sections to an already existant binary.
- Make phdrs only copy if they're needed, and/or modify old phdrs to
point to new sections
- Make sure nothing is missing from fixup_dynamic()
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>