--- a/compat/include/protocols/dumprestore.h
+++ b/compat/include/protocols/dumprestore.h
@@ -44,6 +44,9 @@
 #define _PROTOCOLS_DUMPRESTORE_H_
 
 #include <config.h>
+#include <stdint.h>
+#include <bsdcompat.h>
+
 
 /*
  * TP_BSIZE is the size of file blocks on the dump tapes.
@@ -78,12 +81,12 @@ typedef u_int32_t	dump_ino_t;
 typedef unsigned int	dump_ino_t;
 #endif
 
-union u_data {
+extern union u_data {
 	char	s_addrs[TP_NINDIR];	/* 1 => data; 0 => hole in inode */
 	int32_t	s_inos[TP_NINOS];	/* table of first inode on each volume */
 } u_data;
 
-union u_spcl {
+extern union u_spcl {
 	char dummy[TP_BSIZE];
 	struct	s_spcl {
 		int32_t	c_type;		    /* record type (see below) */
--- a/dump/main.c
+++ b/dump/main.c
@@ -74,6 +74,7 @@
 
 #include <protocols/dumprestore.h>
 
+
 #include "dump.h"
 #include "pathnames.h"
 #include "bylabel.h"
--- a/restore/main.c
+++ b/restore/main.c
@@ -66,6 +66,7 @@
 #endif	/* __linux__ */
 #include <protocols/dumprestore.h>
 
+
 #include <compaterr.h>
 #include <stdio.h>
 #include <stdlib.h>
--- a/dump/itime.c
+++ b/dump/itime.c
@@ -71,11 +71,6 @@
 
 #include "dump.h"
 
-struct	dumpdates **ddatev;
-int	nddates;
-int	ddates_in;
-struct	dumptime *dthead;
-
 static	void dumprecout (FILE *, struct dumpdates *);
 static	int getrecord (FILE *, struct dumpdates *);
 static	int makedumpdate (struct dumpdates *, char *);
--- a/common/legacy_indexer.c
+++ b/common/legacy_indexer.c
@@ -49,10 +49,8 @@ static int GetTapePos (long long *);
 static int MkTapeString (struct s_spcl *, long long);
 #define FILESQFAPOS	20
 
-int tapepos;
-int ntrec;		/* blocking factor on tape */
-//extern int tapepos;
-//extern int ntrec;		/* blocking factor on tape */
+extern int tapepos;
+extern int ntrec;		/* blocking factor on tape */
 extern int magtapeout;  /* is output a magnetic tape? */
 
 static int gtperr = 0;
--- a/restore/restore.h
+++ b/restore/restore.h
@@ -131,7 +131,7 @@ struct entry {
 /*
  * The entry describes the next file available on the tape
  */
-struct context {
+extern struct context {
 	char	*name;		/* name of file */
 	dump_ino_t ino;		/* inumber of file */
 #if defined(__linux__) || defined(sunos)
--- a/compat/lib/Makefile.am
+++ b/compat/lib/Makefile.am
@@ -6,6 +6,7 @@ libcompat_la_SOURCES = \
 	bylabel.c \
 	compaterr.c \
 	compatglob.c \
+	dumprestore.c	\
 	rmtflags.c \
 	system.c
 libcompat_la_LIBADD = \
--- /dev/null
+++ b/compat/lib/dumprestore.c
@@ -0,0 +1,5 @@
+#include <protocols/dumprestore.h>
+
+union u_spcl u_spcl;
+union u_data u_data;
+
--- a/configure.ac
+++ b/configure.ac
@@ -28,9 +28,6 @@ AC_SUBST([DATE], ["1 Jan 2021"])
 
 CPPFLAGS="${CPPFLAGS} -D_USE_BSD_SIGNAL "'-D_PATH_DUMPDATES=\"$(DUMPDATESPATH)\" -D_DUMP_VERSION=\"$(VERSION)\"'
 
-dnl This codebase is a mess with its storage.  It should get fixed someday.
-dnl https://sourceforge.net/p/dump/bugs/171/
-CFLAGS="${CFLAGS} -fcommon"
 
 AC_DEFINE([LINUX_FORK_BUG], 1, [Workaround bad fork behavior on Linux])
 
--- a/restore/restore.c
+++ b/restore/restore.c
@@ -71,6 +71,7 @@
 #include "restore.h"
 #include "extern.h"
 
+struct context curfile;
 static char *keyval (int);
 
 /*
