about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/glibc
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/libraries/glibc
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/glibc')
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch133
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/2.33-master.patch.gzbin155232 -> 0 bytes
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/2.35-master.patch.gzbin0 -> 230755 bytes
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/common.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/info.nix2
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/mtrace.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/multi.nix3
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch45
9 files changed, 206 insertions, 50 deletions
diff --git a/nixpkgs/pkgs/development/libraries/glibc/0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch b/nixpkgs/pkgs/development/libraries/glibc/0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch
new file mode 100644
index 000000000000..b2c998aabbef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch
@@ -0,0 +1,133 @@
+From faeeb0f353f5540da2015a41cb60fe43d199a1ac Mon Sep 17 00:00:00 2001
+From: Bernardo Meurer <bernardo@meurer.org>
+Date: Fri, 22 Jul 2022 22:11:07 -0700
+Subject: [PATCH] Revert "Remove all usage of @BASH@ or ${BASH} in installed
+ files, and hardcode /bin/bash instead"
+
+We need the ability to override to use `/bin/sh` here to avoid having
+some bootstrap tools in a final build product.
+
+This reverts commit 5188a9d0265cc6f7235a8af1d31ab02e4a24853d.
+
+Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
+---
+ debug/Makefile     | 5 +++--
+ debug/xtrace.sh    | 2 +-
+ elf/Makefile       | 4 +++-
+ elf/ldd.bash.in    | 2 +-
+ elf/sotruss.sh     | 2 +-
+ malloc/Makefile    | 5 +++--
+ malloc/memusage.sh | 2 +-
+ timezone/Makefile  | 3 ++-
+ 8 files changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/debug/Makefile b/debug/Makefile
+index 96029f32ee..cbbdeda277 100644
+--- a/debug/Makefile
++++ b/debug/Makefile
+@@ -238,7 +238,8 @@ $(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
+ 
+ $(objpfx)xtrace: xtrace.sh
+ 	rm -f $@.new
+-	sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
+-	    -e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
++	sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
++	    -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \
++	    -e 's|@PKGVERSION@|$(PKGVERSION)|' \
+ 	    -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
+ 	&& rm -f $@ && mv $@.new $@ && chmod +x $@
+diff --git a/debug/xtrace.sh b/debug/xtrace.sh
+index 8c56e01449..c760391a33 100755
+--- a/debug/xtrace.sh
++++ b/debug/xtrace.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#! @BASH@
+ # Copyright (C) 1999-2022 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+diff --git a/elf/Makefile b/elf/Makefile
+index 3536b6af5e..83521d9dbc 100644
+--- a/elf/Makefile
++++ b/elf/Makefile
+@@ -256,7 +256,8 @@ $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
+ 	$(common-objpfx)libc_nonshared.a
+ 
+ $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
+-	sed -e 's%@VERSION@%$(version)%g' \
++	sed -e 's%@BASH@%$(BASH)%g' \
++	    -e 's%@VERSION@%$(version)%g' \
+ 	    -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
+ 	    -e 's%@PREFIX@%$(prefix)%g' \
+ 	    -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
+@@ -1363,6 +1364,7 @@ ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
+ 	      -e 's%@VERSION@%$(version)%g' \
+ 	      -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
+ 	      -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
++	      -e 's%@BASH@%$(BASH)%g' \
+ 	      -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
+ 
+ ifeq ($(ldd-rewrite-script),no)
+diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
+index 3253b32ef8..127eb59206 100644
+--- a/elf/ldd.bash.in
++++ b/elf/ldd.bash.in
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#! @BASH@
+ # Copyright (C) 1996-2022 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+diff --git a/elf/sotruss.sh b/elf/sotruss.sh
+index 22327eac5c..7d15bf4fc8 100755
+--- a/elf/sotruss.sh
++++ b/elf/sotruss.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#! @BASH@
+ # Copyright (C) 2011-2022 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+diff --git a/malloc/Makefile b/malloc/Makefile
+index 2329cf718a..5d7de4bee7 100644
+--- a/malloc/Makefile
++++ b/malloc/Makefile
+@@ -307,8 +307,9 @@ $(objpfx)mtrace: mtrace.pl
+ 
+ $(objpfx)memusage: memusage.sh
+ 	rm -f $@.new
+-	sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
+-	    -e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
++	sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
++	    -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \
++	    -e 's|@PKGVERSION@|$(PKGVERSION)|' \
+ 	    -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
+ 	&& rm -f $@ && mv $@.new $@ && chmod +x $@
+ 
+diff --git a/malloc/memusage.sh b/malloc/memusage.sh
+index f447160b7d..faa4936639 100755
+--- a/malloc/memusage.sh
++++ b/malloc/memusage.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#! @BASH@
+ # Copyright (C) 1999-2022 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+diff --git a/timezone/Makefile b/timezone/Makefile
+index a789c22d26..d65bdf2391 100644
+--- a/timezone/Makefile
++++ b/timezone/Makefile
+@@ -130,7 +130,8 @@ $(testdata)/XT5: testdata/gen-XT5.sh
+ 	mv $@.tmp $@
+ 
+ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
+-	sed -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
++	sed -e 's|/bin/bash|$(BASH)|' \
++	    -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
+ 	    -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
+ 	    -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
+ 	    -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
+-- 
+2.37.0
+
diff --git a/nixpkgs/pkgs/development/libraries/glibc/2.33-master.patch.gz b/nixpkgs/pkgs/development/libraries/glibc/2.33-master.patch.gz
deleted file mode 100644
index 777e94e2b2ea..000000000000
--- a/nixpkgs/pkgs/development/libraries/glibc/2.33-master.patch.gz
+++ /dev/null
Binary files differdiff --git a/nixpkgs/pkgs/development/libraries/glibc/2.35-master.patch.gz b/nixpkgs/pkgs/development/libraries/glibc/2.35-master.patch.gz
new file mode 100644
index 000000000000..24939e1c0899
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/2.35-master.patch.gz
Binary files differdiff --git a/nixpkgs/pkgs/development/libraries/glibc/common.nix b/nixpkgs/pkgs/development/libraries/glibc/common.nix
index ffec9972d287..6ed0a4d4da0f 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/common.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/common.nix
@@ -43,9 +43,9 @@
 } @ args:
 
 let
-  version = "2.33";
-  patchSuffix = "-117";
-  sha256 = "sha256-LiVWAA4QXb1X8Layoy/yzxc73k8Nhd/8z9i35RoGd/8=";
+  version = "2.35";
+  patchSuffix = "-163";
+  sha256 = "sha256-USNzL2tnzNMZMF79OZlx1YWSEivMKmUYob0lEN0M9S4=";
 in
 
 assert withLinuxHeaders -> linuxHeaders != null;
@@ -62,14 +62,14 @@ stdenv.mkDerivation ({
   patches =
     [
       /* No tarballs for stable upstream branch, only https://sourceware.org/git/glibc.git and using git would complicate bootstrapping.
-          $ git fetch --all -p && git checkout origin/release/2.33/master && git describe
-          glibc-2.33-117-g55446dd8a2
-          $ git show --minimal --reverse glibc-2.33.. | gzip -9n --rsyncable - > 2.33-master.patch.gz
+          $ git fetch --all -p && git checkout origin/release/2.35/master && git describe
+          glibc-2.35-210-ge123f08ad5
+          $ git show --minimal --reverse glibc-2.35.. | gzip -9n --rsyncable - > 2.35-master.patch.gz
 
          To compare the archive contents zdiff can be used.
-          $ zdiff -u 2.33-master.patch.gz ../nixpkgs/pkgs/development/libraries/glibc/2.33-master.patch.gz
+          $ zdiff -u 2.35-master.patch.gz ../nixpkgs/pkgs/development/libraries/glibc/2.35-master.patch.gz
        */
-      ./2.33-master.patch.gz
+      ./2.35-master.patch.gz
 
       /* Allow NixOS and Nix to handle the locale-archive. */
       ./nix-locale-archive.patch
@@ -115,16 +115,12 @@ stdenv.mkDerivation ({
         sha256 = "091bk3kyrx1gc380gryrxjzgcmh1ajcj8s2rjhp2d2yzd5mpd5ps";
       })
 
-      /* Provide utf-8 locales by default, so we can use it in stdenv without depending on our large locale-archive. */
-      (fetchurl {
-        url = "https://salsa.debian.org/glibc-team/glibc/raw/49767c9f7de4828220b691b29de0baf60d8a54ec/debian/patches/localedata/locale-C.diff";
-        sha256 = "0irj60hs2i91ilwg5w7sqrxb695c93xg0ik7yhhq9irprd7fidn4";
-      })
-
       ./fix-x64-abi.patch
 
       /* https://github.com/NixOS/nixpkgs/pull/137601 */
       ./nix-nss-open-files.patch
+
+      ./0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch
     ]
     ++ lib.optional stdenv.hostPlatform.isMusl ./fix-rpc-types-musl-conflicts.patch
     ++ lib.optional stdenv.buildPlatform.isDarwin ./darwin-cross-build.patch;
@@ -138,6 +134,10 @@ stdenv.mkDerivation ({
       # nscd needs libgcc, and we don't want it dynamically linked
       # because we don't want it to depend on bootstrap-tools libs.
       echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
+
+      # Ensure that `__nss_files_fopen` can still be wrapped by `libredirect`.
+      sed -i -e '/libc_hidden_def (__nss_files_fopen)/d' nss/nss_files_fopen.c
+      sed -i -e '/libc_hidden_proto (__nss_files_fopen)/d' include/nss_files.h
     ''
     # FIXME: find a solution for infinite recursion in cross builds.
     # For now it's hopefully acceptable that IDN from libc doesn't reliably work.
@@ -157,7 +157,7 @@ stdenv.mkDerivation ({
     [ "-C"
       "--enable-add-ons"
       "--sysconfdir=/etc"
-      "--enable-stackguard-randomization"
+      "--enable-stack-protector=strong"
       "--enable-bind-now"
       (lib.withFeatureAs withLinuxHeaders "headers" "${linuxHeaders}/include")
       (lib.enableFeature profilingLibraries "profile")
@@ -167,6 +167,9 @@ stdenv.mkDerivation ({
       # and on aarch64 with binutils 2.30 or later.
       # https://sourceware.org/glibc/wiki/PortStatus
       "--enable-static-pie"
+    ] ++ lib.optionals stdenv.hostPlatform.isx86 [
+      # Enable Intel Control-flow Enforcement Technology (CET) support
+      "--enable-cet"
     ] ++ lib.optionals withLinuxHeaders [
       "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
     ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
@@ -188,8 +191,10 @@ stdenv.mkDerivation ({
 
   installFlags = [ "sysconfdir=$(out)/etc" ];
 
+  # out as the first output is an exception exclusive to glibc
   outputs = [ "out" "bin" "dev" "static" ];
 
+  strictDeps = true;
   depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ bison python3Minimal ] ++ extraNativeBuildInputs;
   buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ] ++ extraBuildInputs;
diff --git a/nixpkgs/pkgs/development/libraries/glibc/default.nix b/nixpkgs/pkgs/development/libraries/glibc/default.nix
index caaacfe4f436..f941f7be769d 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/default.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/default.nix
@@ -40,13 +40,10 @@ callPackage ./common.nix { inherit stdenv; } {
       makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
     '';
 
-    # The stackprotector and fortify hardening flags are autodetected by glibc
-    # and enabled by default if supported. Setting it for every gcc invocation
-    # does not work.
-    hardeningDisable = [ "stackprotector" "fortify" ]
-    # XXX: Not actually musl-speciic but since only musl enables pie by default,
-    #      limit rebuilds by only disabling pie w/musl
-      ++ lib.optional stdenv.hostPlatform.isMusl "pie";
+    # The pie, stackprotector and fortify hardening flags are autodetected by
+    # glibc and enabled by default if supported. Setting it for every gcc
+    # invocation does not work.
+    hardeningDisable = [ "fortify" "pie" "stackprotector" ];
 
     NIX_CFLAGS_COMPILE = lib.concatStringsSep " "
       (builtins.concatLists [
@@ -67,8 +64,12 @@ callPackage ./common.nix { inherit stdenv; } {
     # store path than that determined when built (as a source for the
     # bootstrap-tools tarball)
     # Building from a proper gcc staying in the path where it was installed,
-    # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
+    # libgcc_s will now be at {gcc}/lib, and gcc's libgcc will be found without
     # any special hack.
+    # TODO: remove this hack. Things that rely on this hack today:
+    # - dejagnu: during linux bootstrap tcl SIGSEGVs
+    # - clang-wrapper in cross-compilation
+    # Last attempt: https://github.com/NixOS/nixpkgs/pull/36948
     preInstall = ''
       if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
           mkdir -p $out/lib
@@ -119,6 +120,17 @@ callPackage ./common.nix { inherit stdenv; } {
 
       # Get rid of more unnecessary stuff.
       rm -rf $out/var $bin/bin/sln
+
+      # Backwards-compatibility to fix e.g.
+      # "configure: error: Pthreads are required to build libgomp" during `gcc`-build
+      # because it's not actually needed anymore to link against `pthreads` since
+      # it's now part of `libc.so.6` itself, but the gcc build breaks if
+      # this doesn't work.
+      ln -sf $out/lib/libpthread.so.0 $out/lib/libpthread.so
+      ln -sf $out/lib/librt.so.1 $out/lib/librt.so
+      ln -sf $out/lib/libdl.so.2 $out/lib/libdl.so
+      ln -sf $out/lib/libutil.so.1 $out/lib/libutil.so
+      touch $out/lib/libpthread.a
     ''
       # For some reason these aren't stripped otherwise and retain reference
       # to bootstrap-tools; on cross-arm this stripping would break objects.
diff --git a/nixpkgs/pkgs/development/libraries/glibc/info.nix b/nixpkgs/pkgs/development/libraries/glibc/info.nix
index 7c4f3f63bf1c..04b0dc00a894 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/info.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/info.nix
@@ -7,7 +7,7 @@ callPackage ./common.nix {} {
 
   configureFlags = [ "--enable-add-ons" ];
 
-  buildInputs = [ texinfo perl ];
+  extraNativeBuildInputs = [ texinfo perl ];
 
   buildPhase = "make info";
 
diff --git a/nixpkgs/pkgs/development/libraries/glibc/mtrace.nix b/nixpkgs/pkgs/development/libraries/glibc/mtrace.nix
index fed24aff2796..4dbcb19af2a4 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/mtrace.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/mtrace.nix
@@ -8,7 +8,7 @@
 # `glibc` needs to be overridden here because it's still needed to `./configure` the source in order
 # to have a build environment where we can call the needed make target.
 
-glibc.overrideAttrs ({ meta ? {}, ... }: {
+glibc.overrideAttrs (oldAttrs: {
   pname = "glibc-mtrace";
 
   buildPhase = ''
@@ -25,14 +25,16 @@ glibc.overrideAttrs ({ meta ? {}, ... }: {
     mv malloc/mtrace $out/bin/
   '';
 
-  # Perl interpreter used for `mtrace`.
-  buildInputs = [ perl ];
+  # Perl checked during configure
+  nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ perl ];
+  # Perl shebang used for `mtrace`.
+  buildInputs = oldAttrs.buildInputs ++ [ perl ];
 
   # Reset a few things declared by `pkgs.glibc`.
   outputs = [ "out" ];
   separateDebugInfo = false;
 
-  meta = meta // {
+  meta = oldAttrs.meta // {
     description = "Perl script used to interpret and provide human readable output of the trace log contained in the file mtracedata, whose contents were produced by mtrace(3).";
   };
 })
diff --git a/nixpkgs/pkgs/development/libraries/glibc/multi.nix b/nixpkgs/pkgs/development/libraries/glibc/multi.nix
index 5d3626b95cc0..be190d77c736 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/multi.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/multi.nix
@@ -6,7 +6,8 @@ let
   glibc64 = glibc;
 in
 runCommand "${nameVersion.name}-multi-${nameVersion.version}"
-  { outputs = [ "bin" "dev" "out"]; } # TODO: no static version here (yet)
+  # out as the first output is an exception exclusive to glibc
+  { outputs = [ "out" "bin" "dev" ]; } # TODO: no static version here (yet)
   ''
     mkdir -p "$out/lib"
     ln -s '${glibc64.out}'/lib/* "$out/lib"
diff --git a/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch b/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch
index 39312951fcf9..2fedf2a7a7db 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch
+++ b/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch
@@ -1,7 +1,8 @@
-diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
---- glibc-2.27-orig/locale/loadarchive.c	2018-02-01 11:17:18.000000000 -0500
-+++ glibc-2.27/locale/loadarchive.c	2018-02-17 22:32:25.680169462 -0500
-@@ -123,6 +123,23 @@
+diff --git a/locale/loadarchive.c b/locale/loadarchive.c
+index 512769eaec..171dbb4ad9 100644
+--- a/locale/loadarchive.c
++++ b/locale/loadarchive.c
+@@ -123,6 +123,23 @@ calculate_head_size (const struct locarhead *h)
    return MAX (namehash_end, MAX (string_end, locrectab_end));
  }
  
@@ -25,7 +26,7 @@ diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
  
  /* Find the locale *NAMEP in the locale archive, and return the
     internalized data structure for its CATEGORY data.  If this locale has
-@@ -202,7 +219,7 @@
+@@ -202,7 +219,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
        archmapped = &headmap;
  
        /* The archive has never been opened.  */
@@ -34,23 +35,25 @@ diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
        if (fd < 0)
  	/* Cannot open the archive, for whatever reason.  */
  	return NULL;
-@@ -397,8 +414,7 @@
+@@ -397,8 +414,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
  	  if (fd == -1)
  	    {
- 	      struct stat64 st;
+ 	      struct __stat64_t64 st;
 -	      fd = __open_nocancel (archfname,
 -				    O_RDONLY|O_LARGEFILE|O_CLOEXEC);
-+	      fd = open_locale_archive ();
++	      fd = open_locale_archive();
  	      if (fd == -1)
  		/* Cannot open the archive, for whatever reason.  */
  		return NULL;
-diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/locale.c
---- glibc-2.27-orig/locale/programs/locale.c	2018-02-01 11:17:18.000000000 -0500
-+++ glibc-2.27/locale/programs/locale.c	2018-02-17 22:36:39.726293213 -0500
-@@ -633,6 +633,24 @@
+diff --git a/locale/programs/locale.c b/locale/programs/locale.c
+index ca0a95be99..e484783402 100644
+--- a/locale/programs/locale.c
++++ b/locale/programs/locale.c
+@@ -633,6 +633,24 @@ nameentcmp (const void *a, const void *b)
+ }
  
  
- static int
++static int
 +open_locale_archive (void)
 +{
 +  int fd = -1;
@@ -68,11 +71,10 @@ diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/l
 +}
 +
 +
-+static int
+ static int
  write_archive_locales (void **all_datap, char *linebuf)
  {
-   struct stat64 st;
-@@ -644,7 +662,7 @@
+@@ -645,7 +663,7 @@ write_archive_locales (void **all_datap, char *linebuf)
    int fd, ret = 0;
    uint32_t cnt;
  
@@ -81,10 +83,11 @@ diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/l
    if (fd < 0)
      return 0;
  
-diff -Naur glibc-2.27-orig/locale/programs/locarchive.c glibc-2.27/locale/programs/locarchive.c
---- glibc-2.27-orig/locale/programs/locarchive.c	2018-02-01 11:17:18.000000000 -0500
-+++ glibc-2.27/locale/programs/locarchive.c	2018-02-17 22:40:51.245293975 -0500
-@@ -117,6 +117,22 @@
+diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
+index f38e835c52..779a3199fc 100644
+--- a/locale/programs/locarchive.c
++++ b/locale/programs/locarchive.c
+@@ -117,6 +117,22 @@ prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
  }
  
  
@@ -107,7 +110,7 @@ diff -Naur glibc-2.27-orig/locale/programs/locarchive.c glibc-2.27/locale/progra
  static void
  create_archive (const char *archivefname, struct locarhandle *ah)
  {
-@@ -578,7 +594,7 @@
+@@ -578,7 +594,7 @@ open_archive (struct locarhandle *ah, bool readonly)
    while (1)
      {
        /* Open the archive.  We must have exclusive write access.  */