From 29aa7117f42f758bc537e03e4bedf66ced0accfa Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 4 Sep 2023 07:55:57 +0200 Subject: glibc: add package (#39695) --- .../repos/builtin/packages/glibc/32cf406.patch | 21 ++++ .../repos/builtin/packages/glibc/39b1f61.patch | 13 ++ .../repos/builtin/packages/glibc/4a531bb.patch | 123 ++++++++++++++++++ .../repos/builtin/packages/glibc/7c8a673.patch | 21 ++++ .../repos/builtin/packages/glibc/fb21f89.patch | 13 ++ .../repos/builtin/packages/glibc/locs-2.22.patch | 19 +++ var/spack/repos/builtin/packages/glibc/locs.patch | 20 +++ var/spack/repos/builtin/packages/glibc/package.py | 140 +++++++++++++++++++++ var/spack/repos/builtin/packages/glibc/texi.patch | 15 +++ 9 files changed, 385 insertions(+) create mode 100644 var/spack/repos/builtin/packages/glibc/32cf406.patch create mode 100644 var/spack/repos/builtin/packages/glibc/39b1f61.patch create mode 100644 var/spack/repos/builtin/packages/glibc/4a531bb.patch create mode 100644 var/spack/repos/builtin/packages/glibc/7c8a673.patch create mode 100644 var/spack/repos/builtin/packages/glibc/fb21f89.patch create mode 100644 var/spack/repos/builtin/packages/glibc/locs-2.22.patch create mode 100644 var/spack/repos/builtin/packages/glibc/locs.patch create mode 100644 var/spack/repos/builtin/packages/glibc/package.py create mode 100644 var/spack/repos/builtin/packages/glibc/texi.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/glibc/32cf406.patch b/var/spack/repos/builtin/packages/glibc/32cf406.patch new file mode 100644 index 0000000000..223301de39 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/32cf406.patch @@ -0,0 +1,21 @@ +From 32cf40699346d37fabfa887bbd95e95004799ae1 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Mon, 6 Sep 2010 14:55:59 +0200 +Subject: [PATCH] Don't mix pattern rules with normal rules + +diff --git a/manual/Makefile b/manual/Makefile +index c5866eb9def..b1f5fa73e5e 100644 +--- a/manual/Makefile ++++ b/manual/Makefile +@@ -232,7 +232,10 @@ ifdef objpfx + .PHONY: stubs + stubs: $(objpfx)stubs + endif +-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%: ++$(objpfx)stubs ../po/manual.pot: ++ $(make-target-directory) ++ touch $@ ++$(objpfx)stamp%: + $(make-target-directory) + touch $@ + diff --git a/var/spack/repos/builtin/packages/glibc/39b1f61.patch b/var/spack/repos/builtin/packages/glibc/39b1f61.patch new file mode 100644 index 0000000000..44cc80e972 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/39b1f61.patch @@ -0,0 +1,13 @@ +diff --git a/malloc/obstack.c b/malloc/obstack.c +index 25a90514f78..c3c7db4a96b 100644 +--- a/malloc/obstack.c ++++ b/malloc/obstack.c +@@ -115,7 +115,7 @@ int obstack_exit_failure = EXIT_FAILURE; + /* A looong time ago (before 1994, anyway; we're not sure) this global variable + was used by non-GNU-C macros to avoid multiple evaluation. The GNU C + library still exports it because somebody might use it. */ +-struct obstack *_obstack_compat; ++struct obstack *_obstack_compat = 0; + compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); + # endif + # endif diff --git a/var/spack/repos/builtin/packages/glibc/4a531bb.patch b/var/spack/repos/builtin/packages/glibc/4a531bb.patch new file mode 100644 index 0000000000..ca4566df5a --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/4a531bb.patch @@ -0,0 +1,123 @@ +commit 4a531bb0b3b582cb693de9f76d2d97d970f9a5d5 +Author: H.J. Lu +Date: Fri Dec 24 20:14:37 2010 -0500 + + Remove `.ctors' and `.dtors' output sections + +diff --git a/config.h.in b/config.h.in +index 18bf01a38c..9e797eb5b7 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -201,6 +201,9 @@ + /* Define if multi-arch DSOs should be generated. */ + #undef USE_MULTIARCH + ++/* Define if `.ctors' and `.dtors' sections shouldn't be used. */ ++#define NO_CTORS_DTORS_SECTIONS ++ + /* + ^L */ + +diff --git a/elf/sofini.c b/elf/sofini.c +index 5e06f0ca92..13e74b7903 100644 +--- a/elf/sofini.c ++++ b/elf/sofini.c +@@ -1,12 +1,14 @@ + /* Finalizer module for ELF shared C library. This provides terminating + null pointer words in the `.ctors' and `.dtors' sections. */ + ++#ifndef NO_CTORS_DTORS_SECTIONS + static void (*const __CTOR_END__[1]) (void) + __attribute__ ((used, section (".ctors"))) + = { 0 }; + static void (*const __DTOR_END__[1]) (void) + __attribute__ ((used, section (".dtors"))) + = { 0 }; ++#endif + + /* Terminate the frame unwind info section with a 4byte 0 as a sentinel; + this would be the 'length' field in a real FDE. */ +diff --git a/elf/soinit.c b/elf/soinit.c +index 6fecbb5674..1db676af01 100644 +--- a/elf/soinit.c ++++ b/elf/soinit.c +@@ -3,6 +3,7 @@ + the `.ctors' and `.dtors' sections so the lists are terminated, and + calling those lists of functions. */ + ++#ifndef NO_CTORS_DTORS_SECTIONS + #include + #include + +@@ -40,3 +41,4 @@ __libc_fini (void) + + void (*_fini_ptr) (void) __attribute__ ((section (".fini_array"))) + = &__libc_fini; ++#endif +diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c +index c6355a8b7b..2af042fe4b 100644 +--- a/sysdeps/i386/init-first.c ++++ b/sysdeps/i386/init-first.c +@@ -59,7 +59,9 @@ _init (int argc, ...) + { + init (&argc); + ++#ifndef NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); ++#endif + } + #endif + +diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c +index f9a7a58deb..60823bd789 100644 +--- a/sysdeps/mach/hurd/i386/init-first.c ++++ b/sysdeps/mach/hurd/i386/init-first.c +@@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, char **envp) + __getopt_clean_environment (envp); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } +diff --git a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c +index 20fa1d4f12..21b5054b0a 100644 +--- a/sysdeps/mach/hurd/powerpc/init-first.c ++++ b/sysdeps/mach/hurd/powerpc/init-first.c +@@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, char **envp) + __getopt_clean_environment (__environ); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } +diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c +index d816625ef4..1f3a821fea 100644 +--- a/sysdeps/sh/init-first.c ++++ b/sysdeps/sh/init-first.c +@@ -59,7 +59,9 @@ _init (int argc, ...) + { + init (&argc); + ++#ifndef NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); ++#endif + } + #endif + +diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c +index 7b2333d4bf..a60212f4ed 100644 +--- a/sysdeps/unix/sysv/linux/init-first.c ++++ b/sysdeps/unix/sysv/linux/init-first.c +@@ -93,7 +93,7 @@ _init (int argc, char **argv, char **envp) + __getopt_clean_environment (envp); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } diff --git a/var/spack/repos/builtin/packages/glibc/7c8a673.patch b/var/spack/repos/builtin/packages/glibc/7c8a673.patch new file mode 100644 index 0000000000..0903ebab76 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/7c8a673.patch @@ -0,0 +1,21 @@ +commit 7c8a67320e26b8c11108bf0a3410d3aef9cf3486 +Author: Ulrich Drepper +Date: Sat Jan 31 00:21:15 2009 +0000 + + * elf/Makefile (ld.so): Adjust the sed script to insert _begin in to + + newer linker scripts. + +diff --git a/elf/Makefile b/elf/Makefile +index 8079fe9f96..e44ff1d382 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -304,7 +304,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map) + $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \ + LC_ALL=C \ + sed -e '/^=========/,/^=========/!d;/^=========/d' \ +- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \ ++ -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \ + > $@.lds + $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ + $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \ diff --git a/var/spack/repos/builtin/packages/glibc/fb21f89.patch b/var/spack/repos/builtin/packages/glibc/fb21f89.patch new file mode 100644 index 0000000000..14f05fdb3f --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/fb21f89.patch @@ -0,0 +1,13 @@ +diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c +index ec040c775e2..ce4d2a4c953 100644 +--- a/sunrpc/rpc_clntout.c ++++ b/sunrpc/rpc_clntout.c +@@ -31,7 +31,7 @@ + */ + #include + #include +-#include ++#include "rpc/types.h" + #include "rpc_parse.h" + #include "rpc_util.h" + #include "proto.h" diff --git a/var/spack/repos/builtin/packages/glibc/locs-2.22.patch b/var/spack/repos/builtin/packages/glibc/locs-2.22.patch new file mode 100644 index 0000000000..e27d2e44f3 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/locs-2.22.patch @@ -0,0 +1,19 @@ +diff --git a/misc/regexp.c b/misc/regexp.c +index ee7d572..e0b4b47 100644 +--- a/misc/regexp.c ++++ b/misc/regexp.c +@@ -23,11 +23,11 @@ + #include + + /* Define the variables used for the interface. */ +-char *loc1; +-char *loc2; ++char *loc1 __attribute__ ((nocommon)); ++char *loc2 __attribute__ ((nocommon)); + + /* Although we do not support the use we define this variable as well. */ +-char *locs; ++char *locs __attribute__ ((nocommon)); + + + /* Find the next match in STRING. The compiled regular expression is diff --git a/var/spack/repos/builtin/packages/glibc/locs.patch b/var/spack/repos/builtin/packages/glibc/locs.patch new file mode 100644 index 0000000000..cf377751c0 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/locs.patch @@ -0,0 +1,20 @@ +--- a/misc/regexp.c ++++ b/misc/regexp.c +@@ -29,14 +29,15 @@ + + #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) + +-/* Define the variables used for the interface. */ +-char *loc1; +-char *loc2; ++/* Define the variables used for the interface. Avoid .symver on common ++ symbol, which just creates a new common symbol, not an alias. */ ++char *loc1 __attribute__ ((nocommon)); ++char *loc2 __attribute__ ((nocommon)); + compat_symbol (libc, loc1, loc1, GLIBC_2_0); + compat_symbol (libc, loc2, loc2, GLIBC_2_0); + + /* Although we do not support the use we define this variable as well. */ +-char *locs; ++char *locs __attribute__ ((nocommon)); + compat_symbol (libc, locs, locs, GLIBC_2_0); diff --git a/var/spack/repos/builtin/packages/glibc/package.py b/var/spack/repos/builtin/packages/glibc/package.py new file mode 100644 index 0000000000..b0566f0427 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/package.py @@ -0,0 +1,140 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * +from spack.util.elf import delete_rpath + + +class Glibc(AutotoolsPackage, GNUMirrorPackage): + """The GNU C Library provides many of the low-level components used + directly by programs written in the C or C++ languages.""" + + homepage = "https://www.gnu.org/software/libc/" + gnu_mirror_path = "libc/glibc-2.33.tar.gz" + git = "https://sourceware.org/git/glibc.git" + + maintainers("haampie") + + build_directory = "build" + + version("master", branch="master") + version("2.38", sha256="16e51e0455e288f03380b436e41d5927c60945abd86d0c9852b84be57dd6ed5e") + version("2.37", sha256="e3a790c2f84eed5c5d569ed6172c253c607dd3962135437da413aa39aa4fd352") + version("2.36", sha256="02efa6ffbbaf3e10e88f16818a862608d04b0ef838c66f6025ae120530792c9c") + version("2.35", sha256="3e8e0c6195da8dfbd31d77c56fb8d99576fb855fafd47a9e0a895e51fd5942d4") + version("2.34", sha256="255b7632746b5fdd478cb7b36bebd1ec1f92c2b552ee364c940f48eb38d07f62") + version("2.33", sha256="ad7dbed6b0cde9ddc90e84856da7e2c1f976a5e791cdee947d8dbb0392fc76cf") + version("2.32", sha256="f52e5bdc6607cb692c0f7134b75b3ba34b5121628a1750c03e3c9aa0b9d9e65a") + version("2.31", sha256="cb2d64fb808affff30d8a99a85de9d2aa67dc2cbac4ae99af4500d6cfea2bda7") + version("2.30", sha256="decb0a29f1410735bed0e8e7247361da2bbf0dcfef7ac15bf26e7f910cb964c0") + version("2.29", sha256="2fc8c555fd0e5dab5b91e7dd0422865c1885be89ff080b2c1357041afbbc717f") + version("2.28", sha256="f318d6e3f1f4ed0b74d2832ac4f491d0fb928e451c9eda594cbf1c3bee7af47c") + version("2.27", sha256="881ca905e6b5eec724de7948f14d66a07d97bdee8013e1b2a7d021ff5d540522") + version("2.26", sha256="dcc2482b00fdb1c316f385f8180e182bbd37c065dc7d8281a4339d2834ef1be7") + version("2.25", sha256="ad984bac07844ecc222039d43bd5f1f1e1571590ea28045232ae3fa404cefc32") + version("2.24", sha256="7e01959a42d37739e40d8ce58f9c14750cc68bc8a8669889ed586f9f03b91fbe") + version("2.23", sha256="2bd08abb24811cda62e17e61e9972f091f02a697df550e2e44ddcfb2255269d2") + version("2.22", sha256="a62610c4084a0fd8cec58eee12ef9e61fdf809c31e7cecbbc28feb8719f08be5") + version("2.21", sha256="8d8f78058f2e9c7237700f76fe4e0ae500db31470290cd0b8a9739c0c8ce9738") + version("2.20", sha256="37e1de410d572a19b707b99786db9822bb4775e9d70517d88937ab12e6d6debc") + version("2.19", sha256="18ad6db70724699d264add80b1f813630d0141cf3a3558b4e1a7c15f6beac796") + version("2.18", sha256="c8e727b5feef883184241a4767725ec280c0288794bc5cd4432497370db47734") + version("2.17", sha256="a3b2086d5414e602b4b3d5a8792213feb3be664ffc1efe783a829818d3fca37a") + version("2.16.0", sha256="a75be51658cc1cfb6324ec6dbdbed416526c44c14814823129f0fcc74c279f6e") + version("2.15", sha256="da6b95d14b722539c2ec02e7ae1221318dba3d27f19c098a882ffa71bb429c20") + version("2.14.1", sha256="f80c40897df49c463a6d5a45f734acbfe1bf42ef209a92a5c217aeb383631bdb") + version("2.13", sha256="bd90d6119bcc2898befd6e1bbb2cb1ed3bb1c2997d5eaa6fdbca4ee16191a906") + version("2.12.2", sha256="6b7392a7b339a3f2db6e4bc8d5418cf29116d9e7e36b313e845cb65e449c5346") + version("2.11.3", sha256="ddc3210f4029991f5142fda7f269f9bfb197917e5d9445ba2d90d31f74cc2765") + version("2.10.1", sha256="cd9743db33389e7b4eb2942a4f365d12fc015f115113b230152280c43ccc7e3f") + version("2.9", sha256="e0210dec2a4ca0a03d8ee26e2a4ebccc915d99f4cdb1489ff0f9f4ce7bda3e30") + version("2.8", sha256="a5b91339355a7bbafc5f44b524556f7f25de83dd56f2c00ef9240dabd6865663") + version("2.7", sha256="f5ef515cb70f8d4cfcee0b3aac05b73def60d897bdb7a71f4356782febfe415a") + version("2.6.1", sha256="6be7639ccad715d25eef560ce9d1637ef206fb9a162714f6ab8167fc0d971cae") + + # Fix for newer GCC, related to -fno-common + patch("locs.patch", when="@2.23:2.25") + patch("locs-2.22.patch", when="@:2.22") + + # _obstack_compat symbol is not initialized + patch("39b1f61.patch", when="@:2.17") + + # docs: install fails with "unknown command hsep / vsep" + patch("texi.patch", when="@2.16.0") + + # rpc/types.h include issue, should be from local version, not system. + patch("fb21f89.patch", when="@:2.16") + + # Use init_array (modified commit 4a531bb to unconditionally define + # NO_CTORS_DTORS_SECTIONS) + patch("4a531bb.patch", when="@:2.12") + + # make: mixed implicit and static pattern rules (trivial issue in docs) + patch("32cf406.patch", when="@:2.10") + + # linker flag output regex + patch("7c8a673.patch", when="@:2.9") + + def patch(self): + # Support gmake >= 4 + filter_file( + " 3.79* | 3.[89]*)", + " 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)", + "configure", + string=True, + ) + + # Suport gcc >= 5 + filter_file( + "3.4* | 4.[0-9]* )", + "3.4* | 4.[0-9]* | [5-9].* | [1-9][0-9]*)", + "configure", + string=True, + ) + + # Support gcc >= 10 + filter_file( + "4.[4-9].* | 4.[1-9][0-9].* | [5-9].* )", + "4.[4-9].* | 4.[1-9][0-9].* | [5-9].* | [1-9][0-9]*)", + "configure", + string=True, + ) + + # Support binutils + filter_file( + "2.1[3-9]*)", + "2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)", + "configure", + string=True, + ) + + depends_on("bison", type="build") + depends_on("texinfo", type="build") + depends_on("gettext", type="build") + depends_on("perl", type="build") + + depends_on("linux-headers") + + with when("@master"): + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + + def configure_args(self): + return [ + "--enable-kernel=4.4.1", + "--with-headers={}".format(self.spec["linux-headers"].prefix.include), + ] + + def build(self, spec, prefix): + # 1. build just ld.so + # 2. drop the rpath from ld.so -- otherwise it cannot be executed + # 3. do the rest of the build that may directly run ld.so + with working_dir(self.build_directory): + make("-C", "..", f"objdir={os.getcwd()}", "lib") + delete_rpath(join_path("elf", "ld.so")) + make() diff --git a/var/spack/repos/builtin/packages/glibc/texi.patch b/var/spack/repos/builtin/packages/glibc/texi.patch new file mode 100644 index 0000000000..1bffc5db04 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/texi.patch @@ -0,0 +1,15 @@ +diff --git a/manual/stdio.texi b/manual/stdio.texi +index be769a5..7b436f0 100644 +--- a/manual/stdio.texi ++++ b/manual/stdio.texi +@@ -3137,7 +3137,7 @@ The postfix tag corresponds to bytes, kilobytes, megabytes, gigabytes, + etc. The full table is: + + @ifinfo +-@multitable @hsep @vsep {' '} {2^10 (1024)} {zetta} {Upper} {10^24 (1000)} ++@multitable {' '} {2^10 (1024)} {zetta} {Upper} {10^24 (1000)} + @item low @tab Multiplier @tab From @tab Upper @tab Multiplier + @item ' ' @tab 1 @tab @tab ' ' @tab 1 + @item k @tab 2^10 (1024) @tab kilo @tab K @tab 10^3 (1000) +-- +1.8.0.1 -- cgit v1.2.3-60-g2f50