diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog
index a88171c052e5d8d95c3112ee451e65dc54bed2a7..02dbd1ab5d9466ee38e49cb194f534dc574d916d 100644
--- a/gcc/cobol/ChangeLog
+++ b/gcc/cobol/ChangeLog
@@ -13,3 +13,4 @@
 	trimmed .h files in convert.cc
 	trimmed .h files in except.cc
 	trimmed .h files in gcobolspec.cc
+	trimmed .h files in genapi.cc
diff --git a/gcc/cobol/cobol-system.h b/gcc/cobol/cobol-system.h
index 830a0b97840af00440fe636bb9e6b91439f5eaef..dca672cd460c26927d31ef93d07a8ea957499341 100644
--- a/gcc/cobol/cobol-system.h
+++ b/gcc/cobol/cobol-system.h
@@ -38,9 +38,11 @@
    defined.  */
 #define __STDC_FORMAT_MACROS
 
+// These must be included before the #poison declarations in system.h.
+
 #include <string>
 #include <vector>
-
+#include <unordered_map>
 
 
 #include "system.h"
diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc
index c98b2d64d7b43af5281623b7f406846111720d9c..d90e3199cf4fd5eef99870de8e89b7c27e33021c 100644
--- a/gcc/cobol/gengen.cc
+++ b/gcc/cobol/gengen.cc
@@ -86,39 +86,19 @@
     I do here, the world will little note, and *I* will not long remember, what it was!
     */
 
-#include <assert.h>
-#include <err.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vector>
-#include <unordered_map>
-#include <string>
-
-#include "config.h"
-#include "system.h"
+#include "cobol-system.h"
 #include "coretypes.h"
-#include "target.h"
 #include "tree.h"
 #include "tree-iterator.h"
 #include "stringpool.h"
 #include "cgraph.h"
-#include "gimplify.h"
 #include "toplev.h"
-
 #include "function.h"
-/* So we can assign to cfun in this file.  */
-#undef cfun
-
 #define HOWEVER_GCC_DEFINES_TREE 1
 #include "gengen.h"
 
-#pragma GCC diagnostic ignored "-Wunused-result"
-
-extern char *cobol_name_mangler(const char *cobol_name);
-
 // We are limiting the programmer to functions with 512 or fewer arguments.
-// Don't like it? Cry me a river.
+// Don't like it?  Cry me a river.
 static const int ARG_LIMIT = 512;
 
 static int sv_current_line_number;