bfd: Fix build with -DDEBUG=2

Message ID yddikhkj77n.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers
Series bfd: Fix build with -DDEBUG=2 |

Commit Message

Rainer Orth Sept. 15, 2025, 11:17 a.m. UTC
  When building with -DDEBUG=2, bfd doesn't compile:

In file included from bfd/elfcode.h:2051,
                 from bfd/elf32.c:23:
bfd/elfcore.h: In function ‘_bfd_elf32_core_find_build_id’:
bfd/elfcore.h:354:3: error: implicit declaration of function ‘elf_debug_file’; did you mean ‘elf_debug_section’? [-Wimplicit-function-declaration]
  354 |   elf_debug_file (&i_ehdr);
      |   ^~~~~~~~~~~~~~
      |   elf_debug_section

This happens because a guard in elfcore.h doesn't match the others.

This patch fixes this, allowing the build to complete.

Tested on amd64-pc-solaris2.11.

I guess that counts as obvious.

	Rainer
  

Comments

Rainer Orth Sept. 25, 2025, 2:45 p.m. UTC | #1
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> When building with -DDEBUG=2, bfd doesn't compile:
>
> In file included from bfd/elfcode.h:2051,
>                  from bfd/elf32.c:23:
> bfd/elfcore.h: In function ‘_bfd_elf32_core_find_build_id’:
> bfd/elfcore.h:354:3: error: implicit declaration of function ‘elf_debug_file’; did you mean ‘elf_debug_section’? [-Wimplicit-function-declaration]
>   354 |   elf_debug_file (&i_ehdr);
>       |   ^~~~~~~~~~~~~~
>       |   elf_debug_section
>
> This happens because a guard in elfcore.h doesn't match the others.
>
> This patch fixes this, allowing the build to complete.
>
> Tested on amd64-pc-solaris2.11.
>
> I guess that counts as obvious.

I haven't heard about this in two weeks.  Unless someone objects, I'll
commit it as obvious in a couple of days.

	Rainer
  

Patch

diff --git a/bfd/elfcore.h b/bfd/elfcore.h
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -350,7 +350,7 @@  NAME(_bfd_elf, core_find_build_id)
     }
 
   elf_swap_ehdr_in (abfd, &x_ehdr, &i_ehdr);
-#if DEBUG
+#if DEBUG & 1
   elf_debug_file (&i_ehdr);
 #endif