[MDEV-21646] Failure to compile my_addr_resolve.c with binutils-2.34 Created: 2020-02-03  Updated: 2020-12-15  Resolved: 2020-02-12

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.2.29, 10.3.20, 10.4.10
Fix Version/s: 5.5.68, 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.2

Type: Bug Priority: Blocker
Reporter: Brian Evans Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None
Environment:

Gentoo


Attachments: Text File mariadb-binutils-2.34.patch    

 Description   

Binutils 2.34 has changed its API so 3 of the calls in my_sys/my_addr_resolve.c cause a failed build.

As seen in Gentoo bug 707852

ld: mysys/libmysys.a(my_addr_resolve.c.o): in function `my_addr_resolve':
my_addr_resolve.c:(.text+0x45): undefined reference to `bfd_get_section_flags'
ld: my_addr_resolve.c:(.text+0x5a): undefined reference to `bfd_get_section_vma'
ld: my_addr_resolve.c:(.text+0x6c): undefined reference to `bfd_get_section_size'
collect2: error: ld returned 1 exit status

Proposed patch is attached, but feel free to modify to your standards or other optimization



 Comments   
Comment by Oleksandr Byelkin [ 2020-02-12 ]

Could you tell us if this patch helps (it is against 5.5 but should be other version applicable)

commit f7837070d292937dc2c624bad438bd1fa99c5c20 (HEAD -> bb-5.5-MDEV-21646, origin/bb-5.5-MDEV-21646)
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date:   Wed Feb 12 14:30:31 2020 +0100
 
    MDEV-21646: Failure to compile my_addr_resolve.c with binutils-2.34
    
    Emulate older API
 
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 7b14a561ba5..6cb1296a3c3 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -49,6 +49,14 @@ static const char *strip_path(const char *s)
 static bfd *bfdh= 0;
 static asymbol **symtable= 0;
 
+#ifndef bfd_get_section_flags
+#define bfd_get_section_flags(H, S) bfd_section_flags(S)
+#endif /* bfd_get_section_flags */
+
+#ifndef bfd_get_section_vma
+#define bfd_get_section_vma(H, S) bfd_section_vma(S)
+#endif /* bfd_get_section_vma */
+
 /**
   finds a file name, a line number, and a function name corresponding to addr.
 

Comment by Oleksandr Byelkin [ 2020-02-12 ]

grknight Thank you a lot for the report and for the patch, could you check if above patch helps?

Comment by Brian Evans [ 2020-02-12 ]

sanja I believe a define for bfd_get_section_size -> bfd_section_size is also required

Comment by Oleksandr Byelkin [ 2020-02-12 ]

grknight, Thank you! You are right, here is the new version:

commit be77fa914c30e92e33e60feb5a3e098c765798af (HEAD -> bb-5.5-MDEV-21646, origin/bb-5.5-MDEV-21646)
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date:   Wed Feb 12 14:30:31 2020 +0100
 
    MDEV-21646: Failure to compile my_addr_resolve.c with binutils-2.34
    
    Emulate older API
 
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 7b14a561ba5..d318f6bf965 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -49,6 +49,18 @@ static const char *strip_path(const char *s)
 static bfd *bfdh= 0;
 static asymbol **symtable= 0;
 
+#ifndef bfd_get_section_flags
+#define bfd_get_section_flags(H, S) bfd_section_flags(S)
+#endif /* bfd_get_section_flags */
+
+#ifndef bfd_get_section_size
+#define bfd_get_section_size(S) bfd_section_size(S)
+#endif /* bfd_get_section_size */
+
+#ifndef bfd_get_section_vma
+#define bfd_get_section_vma(H, S) bfd_section_vma(S)
+#endif /* bfd_get_section_vma */
+
 /**
   finds a file name, a line number, and a function name corresponding to addr.
 

Comment by Brian Evans [ 2020-02-12 ]

Latest patch compiles fine with current releases on binutils 2.34

Generated at Thu Feb 08 09:08:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.