diff --git a/src/target/arm_semihosting.c b/src/target/arm_semihosting.c
index 8db60a582dbc18439f6dd353366b9df3cf65c7dc..c41c5a0087f6fc5350b8ed1402a448c7f8836219 100644
--- a/src/target/arm_semihosting.c
+++ b/src/target/arm_semihosting.c
@@ -43,6 +43,7 @@
 #include "arm_semihosting.h"
 #include <helper/binarybuffer.h>
 #include <helper/log.h>
+#include <sys/stat.h>
 
 static int open_modeflags[12] = {
 	O_RDONLY,