diff --git a/libc/Android.mk b/libc/Android.mk
index 002978c4e..1b3965e03 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -263,7 +263,6 @@ libc_upstream_freebsd_src_files := \
     upstream-freebsd/lib/libc/string/wmemset.c \
 
 libc_upstream_netbsd_src_files := \
-    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
     upstream-netbsd/common/lib/libc/stdlib/random.c \
     upstream-netbsd/lib/libc/gen/ftw.c \
     upstream-netbsd/lib/libc/gen/nftw.c \
@@ -704,6 +703,7 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 LOCAL_SYSTEM_SHARED_LIBRARIES :=
 
 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
+$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
 include $(BUILD_STATIC_LIBRARY)
 
 
diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk
index 38301bc20..47e436c6e 100644
--- a/libc/arch-arm/arm.mk
+++ b/libc/arch-arm/arm.mk
@@ -65,6 +65,9 @@ libc_bionic_src_files_arm += \
 libc_arch_static_src_files_arm := arch-arm/bionic/exidx_static.c
 libc_arch_dynamic_src_files_arm := arch-arm/bionic/exidx_dynamic.c
 
+libc_netbsd_src_files_arm := \
+    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
+
 ## CPU variant specific source files
 ifeq ($(strip $(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT)),)
   $(warning TARGET_$(my_2nd_arch_prefix)ARCH is arm, but TARGET_$(my_2nd_arch_prefix)CPU_VARIANT is not defined)
diff --git a/libc/arch-mips/mips.mk b/libc/arch-mips/mips.mk
index fe5e24d59..0a3718bc4 100644
--- a/libc/arch-mips/mips.mk
+++ b/libc/arch-mips/mips.mk
@@ -68,6 +68,8 @@ libc_bionic_src_files_mips += \
     arch-mips/string/memset.S \
     arch-mips/string/mips_strlen.c \
 
+libc_netbsd_src_files_mips := \
+    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 
 libc_crt_target_cflags_mips := \
     $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk
index 3dc71d15b..8aa2645d3 100644
--- a/libc/arch-x86/x86.mk
+++ b/libc/arch-x86/x86.mk
@@ -40,6 +40,9 @@ endif
 include $(arch_variant_mk)
 libc_common_additional_dependencies += $(arch_variant_mk)
 
+libc_netbsd_src_files_x86 := \
+    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
+
 arch_variant_mk :=
 
 libc_crt_target_cflags_x86 := \
diff --git a/libc/include/sha1.h b/libc/include/sha1.h
deleted file mode 100644
index 7f6cf5d8c..000000000
--- a/libc/include/sha1.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _SHA1_H_
-#define _SHA1_H_
-
-#warning "include <sys/sha1.h> instead for better portability"
-#include <sys/sha1.h>
-
-#endif
diff --git a/libc/include/sys/sha1.h b/libc/upstream-netbsd/android/include/sys/sha1.h
similarity index 100%
rename from libc/include/sys/sha1.h
rename to libc/upstream-netbsd/android/include/sys/sha1.h