4040#include " glog/logging.h"
4141#include " googletest.h"
4242#include " utilities.h"
43+ #include " stacktrace.h"
4344
4445#ifdef GLOG_USE_GFLAGS
4546# include < gflags/gflags.h>
@@ -60,7 +61,8 @@ using namespace google;
6061
6162# define always_inline
6263
63- # if defined(__ELF__) || defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
64+ # if defined(HAVE_ELF_H) || defined(HAVE_SYS_EXEC_ELF_H) || \
65+ defined (GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
6466// A wrapper function for Symbolize() to make the unit test simple.
6567static const char* TrySymbolize(void * pc, google::SymbolizeOptions options =
6668 google::SymbolizeOptions::kNone ) {
@@ -73,8 +75,7 @@ static const char* TrySymbolize(void* pc, google::SymbolizeOptions options =
7375}
7476# endif
7577
76- # if defined(__ELF__)
77-
78+ # if defined(HAVE_ELF_H) || defined(HAVE_SYS_EXEC_ELF_H)
7879// This unit tests make sense only with GCC.
7980// Uses lots of GCC specific features.
8081# if defined(__GNUC__) && !defined(__OPENCC__)
@@ -449,15 +450,15 @@ __declspec(noinline) void TestWithReturnAddress() {
449450# endif
450451 cout << " Test case TestWithReturnAddress passed." << endl;
451452}
452- # endif // __ELF__
453- #endif // HAVE_STACKTRACE
453+ # endif
454+ #endif // HAVE_STACKTRACE
454455
455456int main (int argc, char ** argv) {
456457 FLAGS_logtostderr = true ;
457458 InitGoogleLogging (argv[0 ]);
458459 InitGoogleTest (&argc, argv);
459460#if defined(HAVE_SYMBOLIZE) && defined(HAVE_STACKTRACE)
460- # if defined(__ELF__ )
461+ # if defined(HAVE_ELF_H) || defined(HAVE_SYS_EXEC_ELF_H )
461462 // We don't want to get affected by the callback interface, that may be
462463 // used to install some callback function at InitGoogle() time.
463464 InstallSymbolizeCallback (nullptr );
@@ -472,7 +473,7 @@ int main(int argc, char** argv) {
472473# else // GLOG_OS_WINDOWS
473474 printf (" PASS (no symbolize_unittest support)\n " );
474475 return 0 ;
475- # endif // __ELF__
476+ # endif // defined(HAVE_ELF_H) || defined(HAVE_SYS_EXEC_ELF_H)
476477#else
477478 printf (" PASS (no symbolize support)\n " );
478479 return 0 ;
0 commit comments