[binutils-gdb] Unconditionally define _initialize_addrmap

Tom Tromey tromey@sourceware.org
Fri Aug 6 18:33:00 GMT 2021


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

commit fd986183343387b019080d81838ad9371593b219
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Aug 6 12:30:51 2021 -0600

    Unconditionally define _initialize_addrmap
    
    The way that init.c is generated does not allow for an initialization
    function to be conditionally defined -- doing so will result in a link
    error.
    
    This patch fixes a build problem that arises from such a conditional
    definition.  It can be reproduce with --disable-unit-tests.

Diff:
---
 gdb/addrmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 22817824cdc..49e51a388e1 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -681,11 +681,13 @@ test_addrmap ()
 }
 
 } // namespace selftests
+#endif /* GDB_SELF_TEST */
 
 void _initialize_addrmap ();
 void
 _initialize_addrmap ()
 {
+#if GDB_SELF_TEST
   selftests::register_test ("addrmap", selftests::test_addrmap);
-}
 #endif /* GDB_SELF_TEST */
+}


More information about the Gdb-cvs mailing list