From d948af6a2ffa99db62cedf019c4109cf0e3763e4 Mon Sep 17 00:00:00 2001 From: Binglin Chang Date: Sun, 3 May 2020 17:26:22 +0800 Subject: [PATCH] Fix build failure after binutils-dev 2.34 (#3449) Doris uses some binutils private API, and binutils-dev 2.34 remove them. This commit makes the code compatible with new versions. --- be/src/util/bfd_parser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/be/src/util/bfd_parser.cpp b/be/src/util/bfd_parser.cpp index 6bd19447f2..a0bff8618e 100644 --- a/be/src/util/bfd_parser.cpp +++ b/be/src/util/bfd_parser.cpp @@ -45,14 +45,28 @@ static void find_addr_in_section(bfd* abfd, asection* sec, void* arg) { if (ctx->found) { return; } +#ifdef bfd_get_section_flags if ((bfd_get_section_flags(abfd, sec) & SEC_ALLOC) == 0) { return; } +#else + if ((bfd_section_flags(sec) & SEC_ALLOC) == 0) { + return; + } +#endif +#ifdef bfd_get_section_vma auto vma = bfd_get_section_vma(abfd, sec); +#else + auto vma = bfd_section_vma(sec); +#endif if (ctx->pc < vma) { return; } +#ifdef bfd_get_section_size auto size = bfd_get_section_size(sec); +#else + auto size = bfd_section_size(sec); +#endif if (ctx->pc >= vma + size) { return; }