decompiler: fix '#error config.h must be included before this header'

See https://sourceware.org/bugzilla/show_bug.cgi?id=14243
This commit is contained in:
Benno Fünfstück 2022-03-08 15:21:23 -05:00 committed by Ryan Kurtz
parent 824723e492
commit fcff16262b

View file

@ -20,8 +20,32 @@
#define __LOADIMAGE_BFD__
#include "loadimage.hh"
// bfd.h requires PACKAGE/PACKAGE_VERSION to be defined
// https://sourceware.org/bugzilla/show_bug.cgi?id=14243
#ifndef PACKAGE
#define PACKAGE
#define __LOADIMAGE_BFD__DEFINED_PACKAGE
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION
#define __LOADIMAGE_BFD__DEFINED_PACKAGE_VERSION
#endif
#include <bfd.h>
#ifdef __LOADIMAGE_BFD__DEFINED_PACKAGE
#undef PACKAGE
#undef __LOADIMAGE_BFD__DEFINED_PACKAGE
#endif
#ifdef __LOADIMAGE_BFD__DEFINED_PACKAGE_VERSION
#undef PACKAGE_VERSION
#undef __LOADIMAGE_BFD__DEFINED_PACKAGE_VERSION
#endif
struct ImportRecord {
string dllname;
string funcname;