Commit Graph

5 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 7a8e75cd9a elfcreator: elfcreator_copy_scn() doesn't need the 'elf' arg
Not used at all, remove it.

Cc: Peter Jones <pjones@redhat.com>
Fixes: 29ef465cd8 ("Add scncopy - like object copy but tries not to change section content")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-20 16:40:27 -03:00
Arnaldo Carvalho de Melo 6d11dd157f elfcreator: Address initialization warning emitted by 'gcc -O6'
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>
2019-12-16 11:19:47 -03:00
Arnaldo Carvalho de Melo 7360f0528f elfcreator: Remove unused 'machine' variable
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>
2019-07-02 12:33:05 -03:00
Domenico Andreoli e714d2eaa1 Adopt SPDX-License-Identifier
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-01-18 15:41:48 -03:00
Peter Jones 29ef465cd8 Add scncopy - like object copy but tries not to change section content
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>
2010-01-12 14:23:32 -02:00