diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c
index f9e8aa2f3a..874f5abfb9 100644
--- a/tools/libxl/libxlu_cfg.c
+++ b/tools/libxl/libxlu_cfg.c
@@ -15,8 +15,7 @@
  * GNU Lesser General Public License for more details.
  */
 
-
-#include "libxl_osdeps.h" /* must come before any other headers */
+#define _GNU_SOURCE
 
 #include <limits.h>
 
diff --git a/tools/libxl/libxlu_cfg_i.h b/tools/libxl/libxlu_cfg_i.h
index 87b19df311..4217f5b28d 100644
--- a/tools/libxl/libxlu_cfg_i.h
+++ b/tools/libxl/libxlu_cfg_i.h
@@ -18,7 +18,6 @@
 #ifndef LIBXLU_CFG_I_H
 #define LIBXLU_CFG_I_H
 
-#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxlu_internal.h"
 #include "libxlu_cfg_y.h"
 
diff --git a/tools/libxl/libxlu_disk.c b/tools/libxl/libxlu_disk.c
index 18fe386dbe..1de16a6a06 100644
--- a/tools/libxl/libxlu_disk.c
+++ b/tools/libxl/libxlu_disk.c
@@ -1,4 +1,3 @@
-#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxlu_internal.h"
 #include "libxlu_disk_l.h"
 #include "libxlu_disk_i.h"
diff --git a/tools/libxl/libxlu_disk_l.c b/tools/libxl/libxlu_disk_l.c
index 05f7ac74a0..32d4b74b58 100644
--- a/tools/libxl/libxlu_disk_l.c
+++ b/tools/libxl/libxlu_disk_l.c
@@ -1,7 +1,7 @@
-#line 2 "libxlu_disk_l.c"
-#include "libxl_osdeps.h" /* must come before any other headers */
+#line 1 "libxlu_disk_l.c"
+#define _GNU_SOURCE
 
-#line 5 "libxlu_disk_l.c"
+#line 4 "libxlu_disk_l.c"
 
 #define  YY_INT_ALIGNED short int
 
@@ -1199,9 +1199,9 @@ static int vdev_and_devtype(DiskParseContext *dpc, char *str) {
 #undef DPC /* needs to be defined differently the actual lexer */
 #define DPC ((DiskParseContext*)yyextra)
 
-#line 1203 "libxlu_disk_l.c"
+#line 1202 "libxlu_disk_l.c"
 
-#line 1205 "libxlu_disk_l.c"
+#line 1204 "libxlu_disk_l.c"
 
 #define INITIAL 0
 #define LEXERR 1
@@ -1483,7 +1483,7 @@ YY_DECL
 #line 180 "libxlu_disk_l.l"
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1487 "libxlu_disk_l.c"
+#line 1486 "libxlu_disk_l.c"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -1836,7 +1836,7 @@ YY_RULE_SETUP
 #line 291 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1840 "libxlu_disk_l.c"
+#line 1839 "libxlu_disk_l.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(LEXERR):
 				yyterminate();
diff --git a/tools/libxl/libxlu_disk_l.h b/tools/libxl/libxlu_disk_l.h
index 54f4662d7a..6abeecf279 100644
--- a/tools/libxl/libxlu_disk_l.h
+++ b/tools/libxl/libxlu_disk_l.h
@@ -2,10 +2,10 @@
 #define xlu__disk_yyHEADER_H 1
 #define xlu__disk_yyIN_HEADER 1
 
-#line 6 "libxlu_disk_l.h"
-#include "libxl_osdeps.h" /* must come before any other headers */
+#line 5 "libxlu_disk_l.h"
+#define _GNU_SOURCE
 
-#line 9 "libxlu_disk_l.h"
+#line 8 "libxlu_disk_l.h"
 
 #define  YY_INT_ALIGNED short int
 
@@ -696,6 +696,6 @@ extern int yylex (yyscan_t yyscanner);
 
 #line 291 "libxlu_disk_l.l"
 
-#line 700 "libxlu_disk_l.h"
+#line 699 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
 #endif /* xlu__disk_yyHEADER_H */
diff --git a/tools/libxl/libxlu_disk_l.l b/tools/libxl/libxlu_disk_l.l
index 7a46f4a30c..3bd639aab0 100644
--- a/tools/libxl/libxlu_disk_l.l
+++ b/tools/libxl/libxlu_disk_l.l
@@ -28,7 +28,7 @@
  */
 
 %top{
-#include "libxl_osdeps.h" /* must come before any other headers */
+#define _GNU_SOURCE
 }
 
 %{
diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 7947687661..bbce719e91 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -1,4 +1,5 @@
-#include "libxl_osdeps.h" /* must come before any other headers */
+#define _GNU_SOURCE
+
 #include "libxlu_internal.h"
 #include "libxlu_disk_l.h"
 #include "libxlu_disk_i.h"
diff --git a/tools/libxl/libxlu_vif.c b/tools/libxl/libxlu_vif.c
index 0665e624dc..ccf0cbdf57 100644
--- a/tools/libxl/libxlu_vif.c
+++ b/tools/libxl/libxlu_vif.c
@@ -1,4 +1,5 @@
-#include "libxl_osdeps.h" /* must come before any other headers */
+#define _GNU_SOURCE
+
 #include "libxlu_internal.h"
 
 static const char *vif_bytes_per_sec_re = "^[0-9]+[GMK]?[Bb]/s$";
