[Asterisk-code-review] Update main/backtrace.c to deal with changes in binutils 2.34. (asterisk[17])

George Joseph asteriskteam at digium.com
Tue Mar 17 09:14:18 CDT 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13972 )

Change subject: Update main/backtrace.c to deal with changes in binutils 2.34.
......................................................................

Update main/backtrace.c to deal with changes in binutils 2.34.

binutils 2.34 merged this commit:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;\
	h=fd3619828e94a24a92cddec42cbc0ab33352eeb4

Which effectively does things like:

-#define bfd_section_size(bfd, ptr) ((ptr)->size)
-#define bfd_get_section_size(ptr) ((ptr)->size)

+#define bfd_section_size(sec) ((sec)->size)

So in order to remain backwards compatible we need to detect this API
change, and adjust accordingly.  The simplest is to notice that the
bfd_get_section_size and bfd_get_section_vma MACROs are no longer
defined, and define then onto the new API.  The alternative is to litter
the code with a number of #ifdef #else #endif splatters right through
the code.

Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f
---
M main/backtrace.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/main/backtrace.c b/main/backtrace.c
index 2623d7f..1bc9bea 100644
--- a/main/backtrace.c
+++ b/main/backtrace.c
@@ -59,6 +59,12 @@
 #if defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES)
 #include <dlfcn.h>
 #include <bfd.h>
+#ifndef bfd_get_section_size
+#define bfd_get_section_size(x) bfd_section_size(x)
+#endif
+#ifndef bfd_get_section_vma
+#define bfd_get_section_vma(x, y)	bfd_section_vma(y)
+#endif
 #endif
 
 #include <pthread.h>

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13972
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f
Gerrit-Change-Number: 13972
Gerrit-PatchSet: 2
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200317/9440f451/attachment-0001.html>


More information about the asterisk-code-review mailing list