Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tracehash for libbfd API changes #207

Open
shenki opened this issue Mar 17, 2022 · 1 comment
Open

Update tracehash for libbfd API changes #207

shenki opened this issue Mar 17, 2022 · 1 comment

Comments

@shenki
Copy link
Member

shenki commented Mar 17, 2022

These were removed in bminor/binutils-gdb@fd36198 which appears in v3.34.

The kernel did this to remain compatible:

commit 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015
Author: Changbin Du <[email protected]>
Date:   Wed Jan 29 01:59:38 2020

    perf: Make perf able to build with latest libbfd
    
    libbfd has changed the bfd_section_* macros to inline functions
    bfd_section_<field> since 2019-09-18. See below two commits:
      o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
      o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html

However it's a mess of:

  • macros that were renamed
  • macros that changed the number of arguments
  • functions that changed the number of arguments

It might make sense to carry a patch in op-build to be compatible with the new version, and once all of the build environments are ready, commit that patch to move to the new API.

extracthash.c: In function ‘parse_traceinfo’:
extracthash.c:246:19: warning: implicit declaration of function ‘bfd_get_section_size’; did you mean ‘bfd_set_section_size’? [-Wimplicit-function-declaration]
  246 |     size_t size = bfd_get_section_size(s);
      |                   ^~~~~~~~~~~~~~~~~~~~
      |                   bfd_set_section_size
tracehash.c: In function ‘main’:
    MAKE       test GEN
./updatetargetxml.pl --hb=../../../../obj/genfiles/target_types_customize_src.xml \
	--common=../common/xmltohb/target_types.xml > ../../../../obj/genfiles/target_types_src.xml
tracehash.c:268:26: warning: passing argument 1 of ‘bfd_set_section_size’ from incompatible pointer type [-Wincompatible-pointer-types]
  268 |     bfd_set_section_size(outFile, hash_section, format_offset);
      |                          ^~~~~~~
      |                          |
      |                          bfd *
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:45: note: expected ‘asection *’ {aka ‘struct bfd_section *’} but argument is of type ‘bfd *’
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |                                   ~~~~~~~~~~^~~
tracehash.c:268:35: warning: passing argument 2 of ‘bfd_set_section_size’ makes integer from pointer without a cast [-Wint-conversion]
  268 |     bfd_set_section_size(outFile, hash_section, format_offset);
      |                                   ^~~~~~~~~~~~
      |                                   |
      |                                   asection * {aka struct bfd_section *}
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:64: note: expected ‘bfd_size_type’ {aka ‘long unsigned int’} but argument is of type ‘asection *’ {aka ‘struct bfd_section *’}
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |                                                  ~~~~~~~~~~~~~~^~~
tracehash.c:268:5: error: too many arguments to function ‘bfd_set_section_size’
  268 |     bfd_set_section_size(outFile, hash_section, format_offset);
      |     ^~~~~~~~~~~~~~~~~~~~
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:13: note: declared here
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |             ^~~~~~~~~~~~~~~~~~~~
../common/xmltohb/create_ekb_targattr.pl \
--fapi=../../../../obj/genfiles/fapiattrs.xml \
--attr=../../../../obj/genfiles/attribute_types_ekb.xml \
--targ=../../../../obj/genfiles/target_types_ekb.xml \
--default=../../../../obj/genfiles/attribute_customization.xml\

../common/xmltohb/create_ekb_targattr.pl \
--fapi=../../../../obj/genfiles/fapiattrs.xml \
--attr=../../../../obj/genfiles/attribute_types_ekb.xml \
--targ=../../../../obj/genfiles/target_types_ekb.xml \
--default=../../../../obj/genfiles/attribute_customization.xml\

tracehash.c: In function ‘fixup_groups’:
tracehash.c:337:9: warning: implicit declaration of function ‘bfd_get_section_flags’; did you mean ‘bfd_set_section_flags’? [-Wimplicit-function-declaration]
  337 |     if (bfd_get_section_flags(newFile, s) & SEC_GROUP)
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         bfd_set_section_flags
    MAKE       test GEN
tracehash.c:351:28: warning: implicit declaration of function ‘bfd_get_section_size’; did you mean ‘bfd_set_section_size’? [-Wimplicit-function-declaration]
  351 |         for(size_t i=1;i<((bfd_get_section_size(s))/sizeof(uint32_t));
      |                            ^~~~~~~~~~~~~~~~~~~~
      |                            bfd_set_section_size
tracehash.c: In function ‘create_sections’:
tracehash.c:452:36: warning: passing argument 1 of ‘bfd_set_section_size’ from incompatible pointer type [-Wincompatible-pointer-types]
  452 |     CHECK_ERR(bfd_set_section_size(outFile, new_s, section_size));
      |                                    ^~~~~~~
      |                                    |
      |                                    bfd *
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:45: note: expected ‘asection *’ {aka ‘struct bfd_section *’} but argument is of type ‘bfd *’
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |                                   ~~~~~~~~~~^~~
tracehash.c:452:45: warning: passing argument 2 of ‘bfd_set_section_size’ makes integer from pointer without a cast [-Wint-conversion]
  452 |     CHECK_ERR(bfd_set_section_size(outFile, new_s, section_size));
      |                                             ^~~~~
      |                                             |
      |                                             asection * {aka struct bfd_section *}
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:64: note: expected ‘bfd_size_type’ {aka ‘long unsigned int’} but argument is of type ‘asection *’ {aka ‘struct bfd_section *’}
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |                                                  ~~~~~~~~~~~~~~^~~
tracehash.c:452:15: error: too many arguments to function ‘bfd_set_section_size’
  452 |     CHECK_ERR(bfd_set_section_size(outFile, new_s, section_size));
      |               ^~~~~~~~~~~~~~~~~~~~
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1447:13: note: declared here
 1447 | bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
      |             ^~~~~~~~~~~~~~~~~~~~
tracehash.c:453:67: warning: passing argument 1 of ‘bfd_section_vma’ from incompatible pointer type [-Wincompatible-pointer-types]
  453 |     CHECK_ERR(bfd_set_section_vma(outFile, new_s, bfd_section_vma(inFile, s)));
      |                                                                   ^~~~~~
      |                                                                   |
      |                                                                   bfd *
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1230:34: note: expected ‘const asection *’ {aka ‘const struct bfd_section *’} but argument is of type ‘bfd *’
 1230 | bfd_section_vma (const asection *sec)
      |                  ~~~~~~~~~~~~~~~~^~~
tracehash.c:453:51: error: too many arguments to function ‘bfd_section_vma’
  453 |     CHECK_ERR(bfd_set_section_vma(outFile, new_s, bfd_section_vma(inFile, s)));
      |                                                   ^~~~~~~~~~~~~~~
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1230:1: note: declared here
 1230 | bfd_section_vma (const asection *sec)
      | ^~~~~~~~~~~~~~~
tracehash.c:453:35: warning: passing argument 1 of ‘bfd_set_section_vma’ from incompatible pointer type [-Wincompatible-pointer-types]
  453 |     CHECK_ERR(bfd_set_section_vma(outFile, new_s, bfd_section_vma(inFile, s)));
      |                                   ^~~~~~~
      |                                   |
      |                                   bfd *
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1276:32: note: expected ‘asection *’ {aka ‘struct bfd_section *’} but argument is of type ‘bfd *’
 1276 | bfd_set_section_vma (asection *sec, bfd_vma val)
      |                      ~~~~~~~~~~^~~
tracehash.c:453:44: warning: passing argument 2 of ‘bfd_set_section_vma’ makes integer from pointer without a cast [-Wint-conversion]
  453 |     CHECK_ERR(bfd_set_section_vma(outFile, new_s, bfd_section_vma(inFile, s)));
      |                                            ^~~~~
      |                                            |
      |                                            asection * {aka struct bfd_section *}
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1276:45: note: expected ‘bfd_vma’ {aka ‘long unsigned int’} but argument is of type ‘asection *’ {aka ‘struct bfd_section *’}
 1276 | bfd_set_section_vma (asection *sec, bfd_vma val)
      |                                     ~~~~~~~~^~~
tracehash.c:453:15: error: too many arguments to function ‘bfd_set_section_vma’
  453 |     CHECK_ERR(bfd_set_section_vma(outFile, new_s, bfd_section_vma(inFile, s)));
      |               ^~~~~~~~~~~~~~~~~~~
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1276:1: note: declared here
 1276 | bfd_set_section_vma (asection *sec, bfd_vma val)
      | ^~~~~~~~~~~~~~~~~~~
tracehash.c:458:63: warning: passing argument 1 of ‘bfd_section_alignment’ from incompatible pointer type [-Wincompatible-pointer-types]
  458 |                                         bfd_section_alignment(inFile, s)));
      |                                                               ^~~~~~
      |                                                               |
      |                                                               bfd *
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1242:40: note: expected ‘const asection *’ {aka ‘const struct bfd_section *’} but argument is of type ‘bfd *’
 1242 | bfd_section_alignment (const asection *sec)
      |                        ~~~~~~~~~~~~~~~~^~~
tracehash.c:458:41: error: too many arguments to function ‘bfd_section_alignment’
  458 |                                         bfd_section_alignment(inFile, s)));
      |                                         ^~~~~~~~~~~~~~~~~~~~~
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1242:1: note: declared here
 1242 | bfd_section_alignment (const asection *sec)
      | ^~~~~~~~~~~~~~~~~~~~~
tracehash.c:457:41: warning: passing argument 1 of ‘bfd_set_section_alignment’ from incompatible pointer type [-Wincompatible-pointer-types]
  457 |     CHECK_ERR(bfd_set_section_alignment(outFile, new_s,
      |                                         ^~~~~~~
      |                                         |
      |                                         bfd *
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1291:38: note: expected ‘asection *’ {aka ‘struct bfd_section *’} but argument is of type ‘bfd *’
 1291 | bfd_set_section_alignment (asection *sec, unsigned int val)
      |                            ~~~~~~~~~~^~~
tracehash.c:457:50: warning: passing argument 2 of ‘bfd_set_section_alignment’ makes integer from pointer without a cast [-Wint-conversion]
  457 |     CHECK_ERR(bfd_set_section_alignment(outFile, new_s,
      |                                                  ^~~~~
      |                                                  |
      |                                                  asection * {aka struct bfd_section *}
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1291:56: note: expected ‘unsigned int’ but argument is of type ‘asection *’ {aka ‘struct bfd_section *’}
 1291 | bfd_set_section_alignment (asection *sec, unsigned int val)
      |                                           ~~~~~~~~~~~~~^~~
tracehash.c:457:15: error: too many arguments to function ‘bfd_set_section_alignment’
  457 |     CHECK_ERR(bfd_set_section_alignment(outFile, new_s,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~
tracehash.c:114:15: note: in definition of macro ‘CHECK_ERR’
  114 |         if (!(i)) \
      |               ^
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1291:1: note: declared here
 1291 | bfd_set_section_alignment (asection *sec, unsigned int val)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
tracehash.c: In function ‘create_hashstring_section’:
tracehash.c:731:27: warning: passing argument 1 of ‘bfd_set_section_flags’ from incompatible pointer type [-Wincompatible-pointer-types]
  731 |     bfd_set_section_flags(outFile, hash_section,
      |                           ^~~~~~~
      |                           |
      |                           bfd *
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1432:46: note: expected ‘asection *’ {aka ‘struct bfd_section *’} but argument is of type ‘bfd *’
 1432 | bfd_boolean bfd_set_section_flags (asection *sec, flagword flags);
      |                                    ~~~~~~~~~~^~~
tracehash.c:731:36: warning: passing argument 2 of ‘bfd_set_section_flags’ makes integer from pointer without a cast [-Wint-conversion]
  731 |     bfd_set_section_flags(outFile, hash_section,
      |                                    ^~~~~~~~~~~~
      |                                    |
      |                                    asection * {aka struct bfd_section *}
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1432:60: note: expected ‘flagword’ {aka ‘unsigned int’} but argument is of type ‘asection *’ {aka ‘struct bfd_section *’}
 1432 | bfd_boolean bfd_set_section_flags (asection *sec, flagword flags);
      |                                                   ~~~~~~~~~^~~~~
tracehash.c:731:5: error: too many arguments to function ‘bfd_set_section_flags’
  731 |     bfd_set_section_flags(outFile, hash_section,
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from tracehash.c:52:
/home/joel/dev/op-build/output/build/host-binutils-2.36.1/bfd/bfd.h:1432:13: note: declared here
 1432 | bfd_boolean bfd_set_section_flags (asection *sec, flagword flags);
      |             ^~~~~~~~~~~~~~~~~~~~~
make[8]: *** [makefile:46: tracehash] Error 1
@dcrowell77
Copy link
Collaborator

Our custom linker relies heavily on libbfd so this tracehash thing is just the tip of the iceberg if that changed. It is quite possible we're going to need to rewrite our linker to use a more stable implementation. Such an effort won't happen for awhile so I hope nobody is holding their breath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants