diff --git a/ld/.Sanitize b/ld/.Sanitize
index 7b212e60cb1..6c47375e005 100644
--- a/ld/.Sanitize
+++ b/ld/.Sanitize
@@ -43,6 +43,7 @@ config
 config.h
 configure.bat
 configure.in
+dep-in.sed
 emulparams
 emultempl
 genscripts.sh
diff --git a/ld/dep-in.sed b/ld/dep-in.sed
new file mode 100644
index 00000000000..78a9cb5021a
--- /dev/null
+++ b/ld/dep-in.sed
@@ -0,0 +1,16 @@
+:loop
+/\\$/N
+/\\$/b loop
+
+s!@INCDIR@!$(INCDIR)!g
+s!@srcdir@/!!g
+s!\.\./bfd/hosts/[^ ]*\.h ! !g
+
+s/\\\n */ /g
+
+s/ *$//
+s/  */ /g
+/:$/d
+
+s/\(.\{50\}[^ ]*\) /\1 \\\
+  /g