[binutils-gdb] bfd: Fix build with -DDEBUG=2

Rainer Orth ro@sourceware.org
Sun Sep 28 09:38:01 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e9b82b912ffcefcf7b00864b5fc9e668b61c8ca0

commit e9b82b912ffcefcf7b00864b5fc9e668b61c8ca0
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Sun Sep 28 11:37:38 2025 +0200

    bfd: Fix build with -DDEBUG=2
    
    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.
    
    2025-09-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
    
            bfd:
            * elfcore.h [DEBUG]: Fix guard.

Diff:
---
 bfd/elfcore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 300cd561688..6f1015e02e5 100644
--- 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


More information about the Binutils-cvs mailing list