mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 06:54:37 +00:00
Overhaul detection the DW_LANG_* enumerators from dwarf.h
elfutils regularly adds new members to the anonymous DWARF language encodings enum which contains the DW_LANG_* enumerators, from the dwarf.h header file. If we want libabigail to keep compiling with older versions of elfutils, we need to detect the absence of a given DW_LANG_* enumerator and avoid using it in that case. Until now, we were doing #ifdef DW_LANG_* for that purpose. But then the DW_LANG_* are *enumerators*, not preprocessor macros. So that preprocessor macro. This patch detects the presence of each of the "newer" DW_LANG_* enumerator using autoconf. And for each DW_LANG_xxx enumerator that is present, autoconf defines the HAVE_DW_LANG_xxx_enumerator macro. Libabigail source code can thus do #ifdef HAVE_DW_LANG_xxx_enumerator to guard the use of DW_LANG_xxx. Tested with the Rust binaries from https://gitlab.gnome.org/federico/abi-rust. * configure.ac: Detect the presence of DW_LANG_{UPC, D, Python, Go, C11, C_plus_plus_03, C_plus_plus_11, C_plus_plus_14, Mips_Assembler, Rust} and define the corresponding HAVE_DW_LANG_*_enumerator macro accordingly. * include/abg-ir.h (LANG_C_plus_plus_03): Define this new enumerator in the translation_unit::language enum. * src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Use the new HAVE_DW_LANG_*_enumerator macros. (get_default_array_lower_bound): Support the translation_unit::LANG_C_plus_plus_03 enumerator. * src/abg-ir.cc (is_cplus_plus_language): Support the translation_unit::LANG_C_plus_plus_03 enumerator. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
932579b480
commit
ffec27fb38
113
configure.ac
113
configure.ac
@ -585,6 +585,8 @@ if test x$ABIGAIL_DEVEL != x; then
|
||||
CXXFLAGS="-g -Wall -Wextra -Werror"
|
||||
fi
|
||||
|
||||
dnl Check if several decls and constant are defined in dependant
|
||||
dnl libraries
|
||||
HAS_EM_AARCH64=no
|
||||
AC_CHECK_DECL([EM_AARCH64],
|
||||
[HAS_EM_AARCH64=yes],
|
||||
@ -621,6 +623,117 @@ if test x$HAS_EM_TILEGX = xyes; then
|
||||
[Defined to 1 if elf.h has EM_TILEGX macro defined])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_UPC=no
|
||||
AC_CHECK_DECL([DW_LANG_UPC],
|
||||
[HAS_DW_LANG_UPC=yes],
|
||||
[HAS_DW_LANG_UPC=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_UPC = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_UPC_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_UPC enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_D=no
|
||||
AC_CHECK_DECL([DW_LANG_D],
|
||||
[HAS_DW_LANG_D=yes],
|
||||
[HAS_DW_LANG_D=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_D = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_D_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_D enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_Python=no
|
||||
AC_CHECK_DECL([DW_LANG_Python],
|
||||
[HAS_DW_LANG_Python=yes],
|
||||
[HAS_DW_LANG_Python=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_Python = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_Python_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_Python enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_Go=no
|
||||
AC_CHECK_DECL([DW_LANG_Go],
|
||||
[HAS_DW_LANG_Go=yes],
|
||||
[HAS_DW_LANG_Go=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_Go = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_Go_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_Go enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_C11=no
|
||||
AC_CHECK_DECL([DW_LANG_C11],
|
||||
[HAS_DW_LANG_C11=yes],
|
||||
[HAS_DW_LANG_C11=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_C11 = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_C11_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_C11 enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_C_plus_plus_03=no
|
||||
AC_CHECK_DECL([DW_LANG_C_plus_plus_03],
|
||||
[HAS_DW_LANG_C_plus_plus_03=yes],
|
||||
[HAS_DW_LANG_C_plus_plus_03=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_C_plus_plus_03 = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_C_plus_plus_03_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_03 enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_C_plus_plus_11=no
|
||||
AC_CHECK_DECL([DW_LANG_C_plus_plus_11],
|
||||
[HAS_DW_LANG_C_plus_plus_11=yes],
|
||||
[HAS_DW_LANG_C_plus_plus_11=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_C_plus_plus_11 = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_C_plus_plus_11_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_11 enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_C_plus_plus_14=no
|
||||
AC_CHECK_DECL([DW_LANG_C_plus_plus_14],
|
||||
[HAS_DW_LANG_C_plus_plus_14=yes],
|
||||
[HAS_DW_LANG_C_plus_plus_14=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_C_plus_plus_14 = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_C_plus_plus_14_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_14 enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_Mips_Assembler=no
|
||||
AC_CHECK_DECL([DW_LANG_Mips_Assembler],
|
||||
[HAS_DW_LANG_Mips_Assembler=yes],
|
||||
[HAS_DW_LANG_Mips_Assembler=no],
|
||||
[[#include <dwarf.h>]])
|
||||
if test x$HAS_DW_LANG_Mips_Assembler = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_Mips_Assembler_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_Mips_Assembler enumerator])
|
||||
fi
|
||||
|
||||
HAS_DW_LANG_Rust=no
|
||||
AC_CHECK_DECL([DW_LANG_Rust],
|
||||
[HAS_LANG_Rust=yes],
|
||||
[HAS_LANG_Rust=no],
|
||||
[[#include <dwarf.h>]])
|
||||
|
||||
if test x$HAS_DW_LANG_Rust = xyes; then
|
||||
AC_DEFINE([HAVE_DW_LANG_Rust_enumerator],
|
||||
1,
|
||||
[Define to 1 if dwarf.h has the DW_LANG_Rust enumerator])
|
||||
fi
|
||||
|
||||
dnl Set large files support
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
|
@ -12194,7 +12194,6 @@ dwarf_language_to_tu_language(size_t l)
|
||||
case DW_LANG_C89:
|
||||
return translation_unit::LANG_C89;
|
||||
case DW_LANG_C:
|
||||
case DW_LANG_C11:
|
||||
return translation_unit::LANG_C;
|
||||
case DW_LANG_Ada83:
|
||||
return translation_unit::LANG_Ada83;
|
||||
@ -12226,51 +12225,53 @@ dwarf_language_to_tu_language(size_t l)
|
||||
return translation_unit::LANG_ObjC;
|
||||
case DW_LANG_ObjC_plus_plus:
|
||||
return translation_unit::LANG_ObjC_plus_plus;
|
||||
#ifdef DW_LANG_Rust
|
||||
|
||||
#ifdef HAVE_DW_LANG_Rust_enumerator
|
||||
case DW_LANG_Rust:
|
||||
return translation_unit::LANG_Rust;
|
||||
#endif
|
||||
#ifdef DW_LANG_UPC
|
||||
|
||||
#ifdef HAVE_DW_LANG_UPC_enumerator
|
||||
case DW_LANG_UPC:
|
||||
return DW_LANG_UPC;
|
||||
return translation_unit::LANG_UPC;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_D
|
||||
#ifdef HAVE_DW_LANG_D_enumerator
|
||||
case DW_LANG_D:
|
||||
return translation_unit::LANG_D;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_Python
|
||||
#ifdef HAVE_DW_LANG_Python_enumerator
|
||||
case DW_LANG_Python:
|
||||
return translation_unit::LANG_Python;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_Go
|
||||
#ifdef HAVE_DW_LANG_Go_enumerator
|
||||
case DW_LANG_Go:
|
||||
return translation_unit::LANG_Go;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_C_plus_plus_03
|
||||
case DW_LANG_C_plus_plus_03:
|
||||
return translation_unit::LANG_C_plus_plus_03;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_C_plus_plus_11
|
||||
case DW_LANG_C_plus_plus_11:
|
||||
return translation_unit::LANG_C_plus_plus_11;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_C11
|
||||
#ifdef HAVE_DW_LANG_C11_enumerator
|
||||
case DW_LANG_C11:
|
||||
return translation_unit::LANG_C11;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_C_plus_plus_14
|
||||
#ifdef HAVE_DW_LANG_C_plus_plus_03_enumerator
|
||||
case DW_LANG_C_plus_plus_03:
|
||||
return translation_unit::LANG_C_plus_plus_03;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DW_LANG_C_plus_plus_11_enumerator
|
||||
case DW_LANG_C_plus_plus_11:
|
||||
return translation_unit::LANG_C_plus_plus_11;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DW_LANG_C_plus_plus_14_enumerator
|
||||
case DW_LANG_C_plus_plus_14:
|
||||
return translation_unit::LANG_C_plus_plus_14;
|
||||
#endif
|
||||
|
||||
#ifdef DW_LANG_Mips_Assembler
|
||||
#ifdef HAVE_DW_LANG_Mips_Assembler_enumerator
|
||||
case DW_LANG_Mips_Assembler:
|
||||
return translation_unit::LANG_Mips_Assembler;
|
||||
#endif
|
||||
|
@ -1113,7 +1113,8 @@ is_c_language(translation_unit::language l)
|
||||
bool
|
||||
is_cplus_plus_language(translation_unit::language l)
|
||||
{
|
||||
return (l == translation_unit::LANG_C_plus_plus_11
|
||||
return (l == translation_unit::LANG_C_plus_plus_03
|
||||
|| l == translation_unit::LANG_C_plus_plus_11
|
||||
|| l == translation_unit::LANG_C_plus_plus_14
|
||||
|| l == translation_unit::LANG_C_plus_plus);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user