Skip to contentSkip to conversation

perf build: Fix a compiler error in util/libbfd.c

PATCH Applied Namhyung Kim 2 participants 4 messages Jul 16 – Jul 17 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf build: Fix a compiler error in util/libbfd.c

The bfd_boolean type was gone and converted to the standard bool type but we have some old code that uses the type. It caused a failure in the build test.

util/libbfd.c: In function 'slurp_symtab':
util/libbfd.c:94:9: error: unknown type name 'bfd_boolean'

     94 |         bfd_boolean dynamic = FALSE;
        |         ^~~~~~~~~~~
  util/libbfd.c:94:31: error: 'FALSE' undeclared (first use in this function)
     94 |         bfd_boolean dynamic = FALSE;
        |                               ^~~~~
  util/libbfd.c:94:31: note: each undeclared identifier is reported only once for each function it appears in
  util/libbfd.c:102:27: error: 'TRUE' undeclared (first use in this function)
    102 |                 dynamic = TRUE;
        |                           ^~~~

Fix it with standard bool type and constants.

---
 tools/perf/util/libbfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/libbfd.c +2 -2
index c1c12308cc12ffea..d8241c7caac50836 100644
@@ -91,7 +91,7 @@ static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)
 	long storage;
 	long symcount;
 	asymbol **syms;
-	bfd_boolean dynamic = FALSE;
+	bool dynamic = false;
 
 	if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0)
 		return bfd_error(bfd_get_filename(abfd));
@@ -99,7 +99,7 @@ static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)
 	storage = bfd_get_symtab_upper_bound(abfd);
 	if (storage == 0L) {
 		storage = bfd_get_dynamic_symtab_upper_bound(abfd);
-		dynamic = TRUE;
+		dynamic = true;
 	}
 	if (storage < 0L)
 		return bfd_error(bfd_get_filename(abfd));
Signature · 1 line
2.55.0.141.g00534a21ce-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Namhyung Kim

The bfd_boolean type was gone and converted to the standard bool type but we have some old code that uses the type. It caused a failure in the build test.

util/libbfd.c: In function 'slurp_symtab':
util/libbfd.c:94:9: error: unknown type name 'bfd_boolean'

     94 |         bfd_boolean dynamic = FALSE;
        |         ^~~~~~~~~~~
  util/libbfd.c:94:31: error: 'FALSE' undeclared (first use in this function)
     94 |         bfd_boolean dynamic = FALSE;
        |                               ^~~~~
  util/libbfd.c:94:31: note: each undeclared identifier is reported only once for each function it appears in
  util/libbfd.c:102:27: error: 'TRUE' undeclared (first use in this function)
    102 |                 dynamic = TRUE;
        |                           ^~~~
Quoted 4 lines

Fix it with standard bool type and constants.

Should we add a fixes tag for backports? It's not clear we can provide a sensible SHA.

Thanks,
Ian

Quoted 29 lines
---
 tools/perf/util/libbfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/libbfd.c +2 -3
index c1c12308cc12ffea..d8241c7caac50836 100644
@@ -91,7 +91,7 @@ static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)
        long storage;
        long symcount;
        asymbol **syms;
-       bfd_boolean dynamic = FALSE;
+       bool dynamic = false;
 
        if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0)
                return bfd_error(bfd_get_filename(abfd));
@@ -99,7 +99,7 @@ static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)
        storage = bfd_get_symtab_upper_bound(abfd);
        if (storage == 0L) {
                storage = bfd_get_dynamic_symtab_upper_bound(abfd);
-               dynamic = TRUE;
+               dynamic = true;
        }
        if (storage < 0L)
                return bfd_error(bfd_get_filename(abfd));
--

2.55.0.141.g00534a21ce-goog

author maintainer
#2 lore raw

Hi Ian,

Quoted 20 lines · Ian Rogers
Quoted 19 lines · Namhyung Kim

The bfd_boolean type was gone and converted to the standard bool type but we have some old code that uses the type. It caused a failure in the build test.

util/libbfd.c: In function 'slurp_symtab':
util/libbfd.c:94:9: error: unknown type name 'bfd_boolean'

     94 |         bfd_boolean dynamic = FALSE;
        |         ^~~~~~~~~~~
  util/libbfd.c:94:31: error: 'FALSE' undeclared (first use in this function)
     94 |         bfd_boolean dynamic = FALSE;
        |                               ^~~~~
  util/libbfd.c:94:31: note: each undeclared identifier is reported only once for each function it appears in
  util/libbfd.c:102:27: error: 'TRUE' undeclared (first use in this function)
    102 |                 dynamic = TRUE;
        |                           ^~~~

Fix it with standard bool type and constants.

Quoted 7 lines
Quoted 2 lines

Should we add a fixes tag for backports? It's not clear we can provide a sensible SHA.

Thanks for your review. Yep, the file was moved and it had the bug before. I was thinking about adding SHA of the move but not sure if it's really worth it.

Thanks,
Namhyung

author maintainer Applied
#3 lore raw
In reply to Namhyung Kim
Quoted 16 lines · Namhyung Kim

The bfd_boolean type was gone and converted to the standard bool type but we have some old code that uses the type. It caused a failure in the build test.

util/libbfd.c: In function 'slurp_symtab':
util/libbfd.c:94:9: error: unknown type name 'bfd_boolean'

     94 |         bfd_boolean dynamic = FALSE;
        |         ^~~~~~~~~~~
  util/libbfd.c:94:31: error: 'FALSE' undeclared (first use in this function)
     94 |         bfd_boolean dynamic = FALSE;
        |                               ^~~~~
  util/libbfd.c:94:31: note: each undeclared identifier is reported only once for each function it appears in
  util/libbfd.c:102:27: error: 'TRUE' undeclared (first use in this function)
    102 |                 dynamic = TRUE;
        |                           ^~~~
Quoted 1 line

[...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung