[Gc] Late definition of feature macro in dyn_load.c

Petter Urkedal urkedal at nbi.dk
Tue Oct 20 14:04:07 PDT 2009

I currently get a compilation error on Linux due to dl_phdr_info being
used undefined in dyn_load.c.  The reason is that the inclusion of
private/gc_priv.h, which includes the required system header, is placed
after the definition of the _GNU_SOURCE feature macro.

* dyn_load.c: Move inclusion of private/gc_priv.h below definition of
feature macro.
-------------- next part --------------
diff --git a/dyn_load.c b/dyn_load.c
index d7acb2f..fe6f5f8 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -26,14 +26,14 @@
  * None of this is safe with dlclose and incremental collection.
  * But then not much of anything is safe in the presence of dlclose.
-#include "private/gc_priv.h"
 #if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)) \
      && !defined(_GNU_SOURCE)
     /* Can't test LINUX, since this must be defined before other includes */
 #   define _GNU_SOURCE
+#include "private/gc_priv.h"
 #if !defined(MACOS) && !defined(_WIN32_WCE)
 #  include <sys/types.h>

More information about the Gc mailing list