diff --git a/glibc-rh2040657-1.patch b/glibc-rh2040657-1.patch new file mode 100644 index 0000000..4a25277 --- /dev/null +++ b/glibc-rh2040657-1.patch @@ -0,0 +1,547 @@ +commit 28713c06129f8f64f88c423266e6ff2880216509 +Author: H.J. Lu +Date: Mon Dec 13 09:43:52 2021 -0800 + + elf: Sort tests and modules-names + + Sort tests and modules-names to reduce future conflicts. + +Conflicts: + elf/Makefile + (Usual backport differences. Recreated tests and module-names + from scratch. Note that the upstream sort order is difficult + to fathom.) + +diff --git a/elf/Makefile b/elf/Makefile +index 535ba4260fb98e64..33df5b4714176adc 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -193,40 +193,134 @@ static-dlopen-environment = \ + tst-tls9-static-ENV = $(static-dlopen-environment) + tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment) + +-tests += restest1 preloadtest loadfail multiload origtest resolvfail \ +- constload1 order noload filter \ +- reldep reldep2 reldep3 reldep4 nodelete nodelete2 \ +- nodlopen nodlopen2 lateglobal initfirst global \ +- restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \ +- tst-tls4 tst-tls5 \ +- tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \ +- tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \ +- tst-align tst-align2 \ +- tst-dlmodcount tst-dlopenrpath tst-deep1 \ +- tst-dlmopen1 tst-dlmopen3 \ +- unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \ +- tst-audit1 tst-audit2 tst-audit8 tst-audit9 \ +- tst-addr1 tst-thrlock \ +- tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \ +- tst-nodelete tst-dlopen-nodelete-reloc) \ +- tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ +- tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ +- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ +- tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ +- tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \ +- tst-unwind-ctor tst-unwind-main tst-audit13 \ +- tst-sonamemove-link tst-sonamemove-dlopen tst-dlopen-tlsmodid \ +- tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \ +- tst-dlopenfail-2 \ +- tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \ +- tst-audit14 tst-audit15 tst-audit16 tst-audit17 \ +- tst-single_threaded tst-single_threaded-pthread \ +- tst-tls-ie tst-tls-ie-dlmopen argv0test \ +- tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \ +- tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \ +- tst-dl-is_dso tst-ro-dynamic \ +- tst-rtld-run-static \ ++tests += \ ++ argv0test \ ++ constload1 \ ++ dblload \ ++ dblunload \ ++ filter \ ++ global \ ++ initfirst \ ++ lateglobal \ ++ loadfail \ ++ multiload \ ++ next \ ++ nodelete \ ++ nodelete2 \ ++ nodlopen \ ++ nodlopen2 \ ++ noload \ ++ order \ ++ order2 \ ++ origtest \ ++ preloadtest \ ++ reldep \ ++ reldep2 \ ++ reldep3 \ ++ reldep4 \ ++ reldep5 \ ++ reldep6 \ ++ reldep7 \ ++ reldep8 \ ++ resolvfail \ ++ restest1 \ ++ restest2 \ ++ tst-absolute-sym \ ++ tst-absolute-zero \ ++ tst-addr1 \ ++ tst-align \ ++ tst-align2 \ ++ tst-audit1 \ ++ tst-audit2 \ ++ tst-audit8 \ ++ tst-audit9 \ ++ tst-audit11 \ ++ tst-audit12 \ ++ tst-audit13 \ ++ tst-audit14 \ ++ tst-audit15 \ ++ tst-audit16 \ ++ tst-audit17 \ ++ tst-auditmany \ ++ tst-auxobj \ ++ tst-auxobj-dlopen \ ++ tst-big-note \ ++ tst-debug1 \ ++ tst-deep1 \ ++ tst-dl-is_dso \ ++ tst-dlmodcount \ ++ tst-dlmopen1 \ ++ tst-dlmopen3 \ ++ tst-dlmopen-dlerror \ ++ tst-dlmopen-gethostbyname \ ++ tst-dlopenfail \ ++ tst-dlopenfail-2 \ ++ tst-dlopenrpath \ ++ tst-dlopen-self \ ++ tst-dlopen-tlsmodid \ ++ tst-dlsym-error \ ++ tst-filterobj \ ++ tst-filterobj-dlopen \ ++ tst-glibc-hwcaps \ ++ tst-glibc-hwcaps-mask \ ++ tst-glibc-hwcaps-prepend \ ++ tst-global1 \ ++ tst-initfinilazyfail \ ++ tst-initorder \ ++ tst-initorder2 \ ++ tst-latepthread \ ++ tst-main1 \ ++ tst-nodelete2 \ ++ tst-nodelete-dlclose \ ++ tst-nodelete-opened \ ++ tst-noload \ ++ tst-null-argv \ ++ tst-relsort1 \ ++ tst-ro-dynamic \ ++ tst-rtld-run-static \ ++ tst-single_threaded \ ++ tst-single_threaded-pthread \ ++ tst-sonamemove-dlopen \ ++ tst-sonamemove-link \ ++ tst-thrlock \ ++ tst-tls10 \ ++ tst-tls11 \ ++ tst-tls12 \ ++ tst-tls13 \ ++ tst-tls14 \ ++ tst-tls15 \ ++ tst-tls16 \ ++ tst-tls17 \ ++ tst-tls18 \ ++ tst-tls19 \ ++ tst-tls20 \ ++ tst-tls21 \ ++ tst-tls4 \ ++ tst-tls5 \ ++ tst-tlsalign \ ++ tst-tlsalign-extern \ ++ tst-tls-dlinfo \ ++ tst-tls-ie \ ++ tst-tls-ie-dlmopen \ ++ tst-tls-manydynamic \ ++ tst-unique1 \ ++ tst-unique2 \ ++ tst-unwind-ctor \ ++ tst-unwind-main \ ++ unload3 \ ++ unload4 \ ++ unload5 \ ++ unload6 \ ++ unload7 \ ++ unload8 \ + # reldep9 ++tests-cxx = \ ++ tst-dlopen-nodelete-reloc \ ++ tst-nodelete \ ++ tst-unique3 \ ++ tst-unique4 \ ++ ++tests += $(if $(CXX),$(tests-cxx)) + tests-internal += loadtest unload unload2 circleload1 \ + neededtest neededtest2 neededtest3 neededtest4 \ + tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ +@@ -264,101 +358,265 @@ tst-tls-many-dynamic-modules-dep-bad = \ + extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \ + tst-tlsalign-vars.o + test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars +-modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ +- testobj1_1 failobj constload2 constload3 unloadmod \ +- dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \ +- nodelmod1 nodelmod2 nodelmod3 nodelmod4 \ +- nodel2mod1 nodel2mod2 nodel2mod3 \ +- nodlopenmod nodlopenmod2 filtmod1 filtmod2 \ +- reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \ +- reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \ +- neededobj1 neededobj2 neededobj3 neededobj4 \ +- neededobj5 neededobj6 firstobj globalmod1 \ +- unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \ +- dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \ +- reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \ +- reldep7mod1 reldep7mod2 \ +- tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \ +- tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \ +- tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \ +- tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \ +- tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \ +- $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \ +- tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \ +- circlemod1 circlemod1a circlemod2 circlemod2a \ +- circlemod3 circlemod3a \ +- reldep8mod1 reldep8mod2 reldep8mod3 \ +- reldep9mod1 reldep9mod2 reldep9mod3 \ +- tst-alignmod tst-alignmod2 \ +- $(modules-execstack-$(have-z-execstack)) \ +- tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \ +- tst-dlmopen1mod tst-auditmod1 \ +- unload3mod1 unload3mod2 unload3mod3 unload3mod4 \ +- unload4mod1 unload4mod2 unload4mod3 unload4mod4 \ +- unload6mod1 unload6mod2 unload6mod3 \ +- unload7mod1 unload7mod2 \ +- unload8mod1 unload8mod1x unload8mod2 unload8mod3 \ +- order2mod1 order2mod2 order2mod3 order2mod4 \ +- tst-unique1mod1 tst-unique1mod2 \ +- tst-unique2mod1 tst-unique2mod2 \ +- tst-auditmod9a tst-auditmod9b \ +- $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \ +- tst-nodelete-uniquemod tst-nodelete-rtldmod \ +- tst-nodelete-zmod \ +- tst-dlopen-nodelete-reloc-mod1 \ +- tst-dlopen-nodelete-reloc-mod2 \ +- tst-dlopen-nodelete-reloc-mod3 \ +- tst-dlopen-nodelete-reloc-mod4 \ +- tst-dlopen-nodelete-reloc-mod5 \ +- tst-dlopen-nodelete-reloc-mod6 \ +- tst-dlopen-nodelete-reloc-mod7 \ +- tst-dlopen-nodelete-reloc-mod8 \ +- tst-dlopen-nodelete-reloc-mod9 \ +- tst-dlopen-nodelete-reloc-mod10 \ +- tst-dlopen-nodelete-reloc-mod11 \ +- tst-dlopen-nodelete-reloc-mod12 \ +- tst-dlopen-nodelete-reloc-mod13 \ +- tst-dlopen-nodelete-reloc-mod14 \ +- tst-dlopen-nodelete-reloc-mod15 \ +- tst-dlopen-nodelete-reloc-mod16 \ +- tst-dlopen-nodelete-reloc-mod17) \ +- tst-initordera1 tst-initorderb1 \ +- tst-initordera2 tst-initorderb2 \ +- tst-initordera3 tst-initordera4 \ +- tst-initorder2a tst-initorder2b tst-initorder2c \ +- tst-initorder2d \ +- tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \ +- tst-array5dep tst-null-argv-lib \ +- tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \ +- tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \ +- tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \ +- tst-latepthreadmod $(tst-tls-many-dynamic-modules) \ +- $(tst-tls-many-dynamic-modules-dep) \ +- $(tst-tls-many-dynamic-modules-dep-bad) \ +- tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \ +- tst-main1mod tst-absolute-sym-lib \ +- tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib \ +- tst-audit13mod1 tst-sonamemove-linkmod1 \ +- tst-sonamemove-runmod1 tst-sonamemove-runmod2 \ +- tst-auditmanymod1 tst-auditmanymod2 tst-auditmanymod3 \ +- tst-auditmanymod4 tst-auditmanymod5 tst-auditmanymod6 \ +- tst-auditmanymod7 tst-auditmanymod8 tst-auditmanymod9 \ +- tst-initlazyfailmod tst-finilazyfailmod \ +- tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \ +- tst-dlopenfailmod3 tst-dlopenfailnodelmod tst-ldconfig-ld-mod \ +- tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee \ +- tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 \ +- tst-single_threaded-mod1 tst-single_threaded-mod2 \ +- tst-single_threaded-mod3 tst-single_threaded-mod4 \ +- tst-tls-ie-mod0 tst-tls-ie-mod1 tst-tls-ie-mod2 \ +- tst-tls-ie-mod3 tst-tls-ie-mod4 tst-tls-ie-mod5 \ +- tst-tls-ie-mod6 libmarkermod1-1 libmarkermod1-2 libmarkermod1-3 \ +- libmarkermod2-1 libmarkermod2-2 \ +- libmarkermod3-1 libmarkermod3-2 libmarkermod3-3 \ +- libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkermod4-4 \ +- tst-tls20mod-bad tst-tls21mod tst-dlmopen-dlerror-mod \ +- tst-auxvalmod \ +- tst-dlmopen-gethostbyname-mod tst-ro-dynamic-mod \ ++modules-names = \ ++ circlemod1 \ ++ circlemod1a \ ++ circlemod2 \ ++ circlemod2a \ ++ circlemod3 \ ++ circlemod3a \ ++ constload2 \ ++ constload3 \ ++ dblloadmod1 \ ++ dblloadmod2 \ ++ dblloadmod3 \ ++ dep1 \ ++ dep2 \ ++ dep3 \ ++ dep4 \ ++ failobj \ ++ filtmod1 \ ++ filtmod2 \ ++ firstobj \ ++ globalmod1 \ ++ libmarkermod1-1 \ ++ libmarkermod1-2 \ ++ libmarkermod1-3 \ ++ libmarkermod2-1 \ ++ libmarkermod2-2 \ ++ libmarkermod3-1 \ ++ libmarkermod3-2 \ ++ libmarkermod3-3 \ ++ libmarkermod4-1 \ ++ libmarkermod4-2 \ ++ libmarkermod4-3 \ ++ libmarkermod4-4 \ ++ ltglobmod1 \ ++ ltglobmod2 \ ++ neededobj1 \ ++ neededobj2 \ ++ neededobj3 \ ++ neededobj4 \ ++ neededobj5 \ ++ neededobj6 \ ++ nextmod1 \ ++ nextmod2 \ ++ nodel2mod1 \ ++ nodel2mod2 \ ++ nodel2mod3 \ ++ nodelmod1 \ ++ nodelmod2 \ ++ nodelmod3 \ ++ nodelmod4 \ ++ nodlopenmod \ ++ nodlopenmod2 \ ++ order2mod1 \ ++ order2mod2 \ ++ order2mod3 \ ++ order2mod4 \ ++ pathoptobj \ ++ reldep4mod1 \ ++ reldep4mod2 \ ++ reldep4mod3 \ ++ reldep4mod4 \ ++ reldep6mod0 \ ++ reldep6mod1 \ ++ reldep6mod2 \ ++ reldep6mod3 \ ++ reldep6mod4 \ ++ reldep7mod1 \ ++ reldep7mod2 \ ++ reldep8mod1 \ ++ reldep8mod2 \ ++ reldep8mod3 \ ++ reldep9mod1 \ ++ reldep9mod2 \ ++ reldep9mod3 \ ++ reldepmod1 \ ++ reldepmod2 \ ++ reldepmod3 \ ++ reldepmod4 \ ++ reldepmod5 \ ++ reldepmod6 \ ++ testobj1 \ ++ testobj1_1 \ ++ testobj2 \ ++ testobj3 \ ++ testobj4 \ ++ testobj5 \ ++ testobj6 \ ++ tst-absolute-sym-lib \ ++ tst-absolute-zero-lib \ ++ tst-alignmod \ ++ tst-alignmod2 \ ++ tst-array2dep \ ++ tst-array5dep \ ++ tst-audit11mod1 \ ++ tst-audit11mod2 \ ++ tst-audit12mod1 \ ++ tst-audit12mod2 \ ++ tst-audit12mod3 \ ++ tst-audit13mod1 \ ++ tst-auditlogmod-1 \ ++ tst-auditlogmod-2 \ ++ tst-auditlogmod-3 \ ++ tst-auditmanymod1 \ ++ tst-auditmanymod2 \ ++ tst-auditmanymod3 \ ++ tst-auditmanymod4 \ ++ tst-auditmanymod5 \ ++ tst-auditmanymod6 \ ++ tst-auditmanymod7 \ ++ tst-auditmanymod8 \ ++ tst-auditmanymod9 \ ++ tst-auditmod1 \ ++ tst-auditmod9a \ ++ tst-auditmod9b \ ++ tst-auditmod11 \ ++ tst-auditmod12 \ ++ tst-auxvalmod \ ++ tst-big-note-lib \ ++ tst-deep1mod1 \ ++ tst-deep1mod2 \ ++ tst-deep1mod3 \ ++ tst-dlmopen1mod \ ++ tst-dlmopen-dlerror-mod \ ++ tst-dlmopen-gethostbyname-mod \ ++ tst-dlopenfaillinkmod \ ++ tst-dlopenfailmod1 \ ++ tst-dlopenfailmod2 \ ++ tst-dlopenfailmod3 \ ++ tst-dlopenfailnodelmod \ ++ tst-dlopenrpathmod \ ++ tst-filterobj-aux \ ++ tst-filterobj-filtee \ ++ tst-filterobj-flt \ ++ tst-finilazyfailmod \ ++ tst-initlazyfailmod \ ++ tst-initorder2a \ ++ tst-initorder2b \ ++ tst-initorder2c \ ++ tst-initorder2d \ ++ tst-initordera1 \ ++ tst-initordera2 \ ++ tst-initordera3 \ ++ tst-initordera4 \ ++ tst-initorderb1 \ ++ tst-initorderb2 \ ++ tst-latepthreadmod \ ++ tst-ldconfig-ld-mod \ ++ tst-main1mod \ ++ tst-nodelete2mod \ ++ tst-nodelete-dlclose-dso \ ++ tst-nodelete-dlclose-plugin \ ++ tst-nodelete-opened-lib \ ++ tst-null-argv-lib \ ++ tst-relsort1mod1 \ ++ tst-relsort1mod2 \ ++ tst-ro-dynamic-mod \ ++ tst-single_threaded-mod1 \ ++ tst-single_threaded-mod2 \ ++ tst-single_threaded-mod3 \ ++ tst-single_threaded-mod4 \ ++ tst-sonamemove-linkmod1 \ ++ tst-sonamemove-runmod1 \ ++ tst-sonamemove-runmod2 \ ++ tst-tls19mod1 \ ++ tst-tls19mod2 \ ++ tst-tls19mod3 \ ++ tst-tls20mod-bad \ ++ tst-tls21mod \ ++ tst-tlsalign-lib \ ++ tst-tls-ie-mod0 \ ++ tst-tls-ie-mod1 \ ++ tst-tls-ie-mod2 \ ++ tst-tls-ie-mod3 \ ++ tst-tls-ie-mod4 \ ++ tst-tls-ie-mod5 \ ++ tst-tls-ie-mod6 \ ++ tst-tlsmod1 \ ++ tst-tlsmod10 \ ++ tst-tlsmod11 \ ++ tst-tlsmod12 \ ++ tst-tlsmod13 \ ++ tst-tlsmod13a \ ++ tst-tlsmod14a \ ++ tst-tlsmod14b \ ++ tst-tlsmod15a \ ++ tst-tlsmod15b \ ++ tst-tlsmod16a \ ++ tst-tlsmod16b \ ++ tst-tlsmod17b \ ++ tst-tlsmod2 \ ++ tst-tlsmod3 \ ++ tst-tlsmod4 \ ++ tst-tlsmod5 \ ++ tst-tlsmod6 \ ++ tst-tlsmod7 \ ++ tst-tlsmod8 \ ++ tst-tlsmod9 \ ++ tst-unique1mod1 \ ++ tst-unique1mod2 \ ++ tst-unique2mod1 \ ++ tst-unique2mod2 \ ++ tst-unwind-ctor-lib \ ++ unload2dep \ ++ unload2mod \ ++ unload3mod1 \ ++ unload3mod2 \ ++ unload3mod3 \ ++ unload3mod4 \ ++ unload4mod1 \ ++ unload4mod2 \ ++ unload4mod3 \ ++ unload4mod4 \ ++ unload6mod1 \ ++ unload6mod2 \ ++ unload6mod3 \ ++ unload7mod1 \ ++ unload7mod2 \ ++ unload8mod1 \ ++ unload8mod1x \ ++ unload8mod2 \ ++ unload8mod3 \ ++ unloadmod \ ++ vismod1 \ ++ vismod2 \ ++ vismod3 \ ++ ++modules-names-cxx = \ ++ tst-dlopen-nodelete-reloc-mod1 \ ++ tst-dlopen-nodelete-reloc-mod10 \ ++ tst-dlopen-nodelete-reloc-mod11 \ ++ tst-dlopen-nodelete-reloc-mod12 \ ++ tst-dlopen-nodelete-reloc-mod13 \ ++ tst-dlopen-nodelete-reloc-mod14 \ ++ tst-dlopen-nodelete-reloc-mod15 \ ++ tst-dlopen-nodelete-reloc-mod16 \ ++ tst-dlopen-nodelete-reloc-mod17 \ ++ tst-dlopen-nodelete-reloc-mod2 \ ++ tst-dlopen-nodelete-reloc-mod3 \ ++ tst-dlopen-nodelete-reloc-mod4 \ ++ tst-dlopen-nodelete-reloc-mod5 \ ++ tst-dlopen-nodelete-reloc-mod6 \ ++ tst-dlopen-nodelete-reloc-mod7 \ ++ tst-dlopen-nodelete-reloc-mod8 \ ++ tst-dlopen-nodelete-reloc-mod9 \ ++ tst-nodelete-rtldmod \ ++ tst-nodelete-uniquemod \ ++ tst-nodelete-zmod \ ++ tst-unique3lib \ ++ tst-unique3lib2 \ ++ tst-unique4lib \ ++ ++modules-names += \ ++ $(if $(CXX),$(modules-names-cxx)) \ ++ $(modules-execstack-$(have-z-execstack)) \ ++ $(tst-tls-many-dynamic-modules) \ ++ $(tst-tls-many-dynamic-modules-dep) \ ++ $(tst-tls-many-dynamic-modules-dep-bad) \ ++ $(tlsmod17a-modules) \ ++ $(tlsmod18a-modules) \ + + # Most modules build with _ISOMAC defined, but those filtered out + # depend on internal headers. diff --git a/glibc-rh2040657-10.patch b/glibc-rh2040657-10.patch new file mode 100644 index 0000000..cff581f --- /dev/null +++ b/glibc-rh2040657-10.patch @@ -0,0 +1,73 @@ +commit 990c953bce06d77360d2e933faa9a008e2c55405 +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + x86: Add x86-64-vN check to early startup + + This ISA level covers the glibc build itself. + cannot be used because this check (by design) happens before + DL_PLATFORM_INIT and the x86 CPU flags initialization. + + Reviewed-by: H.J. Lu + +diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile +index 5ee06f94735e5189..36ca1a7126047b86 100644 +--- a/sysdeps/x86/Makefile ++++ b/sysdeps/x86/Makefile +@@ -7,6 +7,7 @@ sysdep_routines += get-cpuid-feature-leaf + sysdep-dl-routines += dl-get-cpu-features + sysdep_headers += sys/platform/x86.h bits/platform/x86.h + ++CFLAGS-dl-get-cpu-features.os += $(rtld-early-cflags) + CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector) + + tests += tst-get-cpu-features tst-get-cpu-features-static \ +diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c +index 839803c746f408ed..6ccde4404b13a725 100644 +--- a/sysdeps/x86/dl-get-cpu-features.c ++++ b/sysdeps/x86/dl-get-cpu-features.c +@@ -20,6 +20,7 @@ + + #ifdef SHARED + # include ++# include + + /* NB: Normally, DL_PLATFORM_INIT calls init_cpu_features to initialize + CPU features in dynamic executable. But when loading ld.so inside of +@@ -36,7 +37,35 @@ _dl_x86_init_cpu_features (void) + { + struct cpu_features *cpu_features = __get_cpu_features (); + if (cpu_features->basic.kind == arch_kind_unknown) +- init_cpu_features (cpu_features); ++ { ++ init_cpu_features (cpu_features); ++ ++# if IS_IN (rtld) ++ /* See isa-level.c. */ ++# if defined GCCMACRO__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \ ++ && defined HAVE_X86_LAHF_SAHF && defined GCCMACRO__POPCNT__ \ ++ && defined GCCMACRO__SSE3__ && defined GCCMACRO__SSSE3__ \ ++ && defined GCCMACRO__SSE4_1__ && defined GCCMACRO__SSE4_2__ ++ if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V2)) ++ _dl_fatal_printf ("\ ++Fatal glibc error: CPU does not support x86-64-v%d\n", 2); ++# if defined GCCMACRO__AVX__ && defined GCCMACRO__AVX2__ \ ++ && defined GCCMACRO__F16C__ && defined GCCMACRO__FMA__ \ ++ && defined GCCMACRO__LZCNT__ && defined HAVE_X86_MOVBE ++ if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V3)) ++ _dl_fatal_printf ("\ ++Fatal glibc error: CPU does not support x86-64-v%d\n", 3); ++# if defined GCCMACRO__AVX512F__ && defined GCCMACRO__AVX512BW__ \ ++ && defined GCCMACRO__AVX512CD__ && defined GCCMACRO__AVX512DQ__ \ ++ && defined GCCMACRO__AVX512VL__ ++ if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V4)) ++ _dl_fatal_printf ("\ ++Fatal glibc error: CPU does not support x86-64-v%d\n", 4); ++# endif /* ISA level 4 */ ++# endif /* ISA level 3 */ ++# endif /* ISA level 2 */ ++# endif /* IS_IN (rtld) */ ++ } + } + + __ifunc (__x86_cpu_features, __x86_cpu_features, NULL, void, diff --git a/glibc-rh2040657-11.patch b/glibc-rh2040657-11.patch new file mode 100644 index 0000000..1ca3409 --- /dev/null +++ b/glibc-rh2040657-11.patch @@ -0,0 +1,37 @@ +commit f01d482f0355a7029d0715ace0ccf3323e7e94bc +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + s390x: Use in early HWCAP check + + This is required so that the checks still work if $(early-cflags) + selects a different ISA level. + + Reviewed-by: Carlos O'Donell + Tested-by: Carlos O'Donell + +diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h +index 87e18be6bd0c512b..27f7e245b1d1a9e9 100644 +--- a/sysdeps/s390/s390-64/dl-hwcap-check.h ++++ b/sysdeps/s390/s390-64/dl-hwcap-check.h +@@ -19,17 +19,18 @@ + #ifndef _DL_HWCAP_CHECK_H + #define _DL_HWCAP_CHECK_H + ++#include + #include + + static inline void + dl_hwcap_check (void) + { + #if defined __ARCH__ +-# if __ARCH__ >= 13 ++# if GCCMACRO__ARCH__ >= 13 + if (!(GLRO(dl_hwcap) & HWCAP_S390_VXRS_EXT2)) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks VXRS_EXT2 support (z15 or later required)\n"); +-# elif __ARCH__ >= 12 ++# elif GCCMACRO__ARCH__ >= 12 + if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE)) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks VXE support (z14 or later required)\n"); diff --git a/glibc-rh2040657-12.patch b/glibc-rh2040657-12.patch new file mode 100644 index 0000000..592c08c --- /dev/null +++ b/glibc-rh2040657-12.patch @@ -0,0 +1,158 @@ +commit c90363403b57b3b7919061851cb3e6d9c85e784a +Author: Florian Weimer +Date: Tue Jan 18 13:53:11 2022 +0100 + + elf: Move _dl_setup_hash to its own file + + And compile it with the early CFLAGS. _dl_setup_hash is called + very early for the ld.so link map, so it should be compiled + differently. + + Reviewed-by: Stefan Liebler + Tested-by: Stefan Liebler + +diff --git a/elf/Makefile b/elf/Makefile +index 778e393395fc5248..948296dc2437e9a1 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -69,6 +69,7 @@ dl-routines = \ + dl-reloc \ + dl-runtime \ + dl-scope \ ++ dl-setup_hash \ + dl-sort-maps \ + dl-thread_gscope_wait \ + dl-tls \ +@@ -154,6 +155,7 @@ CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines)) + + # Add the requested compiler flags to the early startup code. + CFLAGS-dl-printf.os += $(rtld-early-cflags) ++CFLAGS-dl-setup_hash.os += $(rtld-early-cflags) + CFLAGS-dl-sysdep.os += $(rtld-early-cflags) + CFLAGS-dl-tunables.os += $(rtld-early-cflags) + CFLAGS-dl-write.os += $(rtld-early-cflags) +diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c +index eea217eb2833164c..3391a990c8d288e5 100644 +--- a/elf/dl-lookup.c ++++ b/elf/dl-lookup.c +@@ -948,51 +948,6 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map, + } + + +-/* Cache the location of MAP's hash table. */ +- +-void +-_dl_setup_hash (struct link_map *map) +-{ +- Elf_Symndx *hash; +- +- if (__glibc_likely (map->l_info[ELF_MACHINE_GNU_HASH_ADDRIDX] != NULL)) +- { +- Elf32_Word *hash32 +- = (void *) D_PTR (map, l_info[ELF_MACHINE_GNU_HASH_ADDRIDX]); +- map->l_nbuckets = *hash32++; +- Elf32_Word symbias = *hash32++; +- Elf32_Word bitmask_nwords = *hash32++; +- /* Must be a power of two. */ +- assert ((bitmask_nwords & (bitmask_nwords - 1)) == 0); +- map->l_gnu_bitmask_idxbits = bitmask_nwords - 1; +- map->l_gnu_shift = *hash32++; +- +- map->l_gnu_bitmask = (ElfW(Addr) *) hash32; +- hash32 += __ELF_NATIVE_CLASS / 32 * bitmask_nwords; +- +- map->l_gnu_buckets = hash32; +- hash32 += map->l_nbuckets; +- map->l_gnu_chain_zero = hash32 - symbias; +- +- /* Initialize MIPS xhash translation table. */ +- ELF_MACHINE_XHASH_SETUP (hash32, symbias, map); +- +- return; +- } +- +- if (!map->l_info[DT_HASH]) +- return; +- hash = (void *) D_PTR (map, l_info[DT_HASH]); +- +- map->l_nbuckets = *hash++; +- /* Skip nchain. */ +- hash++; +- map->l_buckets = hash; +- hash += map->l_nbuckets; +- map->l_chain = hash; +-} +- +- + static void + _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, + const ElfW(Sym) **ref, struct sym_val *value, +diff --git a/elf/dl-setup_hash.c b/elf/dl-setup_hash.c +new file mode 100644 +index 0000000000000000..6dd57c5c94e541c2 +--- /dev/null ++++ b/elf/dl-setup_hash.c +@@ -0,0 +1,63 @@ ++/* Cache the location of a link map hash table. ++ Copyright (C) 1995-2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++void ++_dl_setup_hash (struct link_map *map) ++{ ++ Elf_Symndx *hash; ++ ++ if (__glibc_likely (map->l_info[ELF_MACHINE_GNU_HASH_ADDRIDX] != NULL)) ++ { ++ Elf32_Word *hash32 ++ = (void *) D_PTR (map, l_info[ELF_MACHINE_GNU_HASH_ADDRIDX]); ++ map->l_nbuckets = *hash32++; ++ Elf32_Word symbias = *hash32++; ++ Elf32_Word bitmask_nwords = *hash32++; ++ /* Must be a power of two. */ ++ assert ((bitmask_nwords & (bitmask_nwords - 1)) == 0); ++ map->l_gnu_bitmask_idxbits = bitmask_nwords - 1; ++ map->l_gnu_shift = *hash32++; ++ ++ map->l_gnu_bitmask = (ElfW(Addr) *) hash32; ++ hash32 += __ELF_NATIVE_CLASS / 32 * bitmask_nwords; ++ ++ map->l_gnu_buckets = hash32; ++ hash32 += map->l_nbuckets; ++ map->l_gnu_chain_zero = hash32 - symbias; ++ ++ /* Initialize MIPS xhash translation table. */ ++ ELF_MACHINE_XHASH_SETUP (hash32, symbias, map); ++ ++ return; ++ } ++ ++ if (!map->l_info[DT_HASH]) ++ return; ++ hash = (void *) D_PTR (map, l_info[DT_HASH]); ++ ++ map->l_nbuckets = *hash++; ++ /* Skip nchain. */ ++ hash++; ++ map->l_buckets = hash; ++ hash += map->l_nbuckets; ++ map->l_chain = hash; ++} diff --git a/glibc-rh2040657-2.patch b/glibc-rh2040657-2.patch new file mode 100644 index 0000000..02b8953 --- /dev/null +++ b/glibc-rh2040657-2.patch @@ -0,0 +1,42 @@ +commit f4f70c2895e3d325188a42c10eb7bb4335be6773 +Author: H.J. Lu +Date: Tue Jan 4 06:58:34 2022 -0800 + + elf: Add a comment after trailing backslashes + +diff --git a/elf/Makefile b/elf/Makefile +index 0cfcf0a61a442c9f..5b9c36bc6f0a3ee5 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -319,6 +319,7 @@ tests-cxx = \ + tst-nodelete \ + tst-unique3 \ + tst-unique4 \ ++# tests-cxx + + tests += $(if $(CXX),$(tests-cxx)) + tests-internal += loadtest unload unload2 circleload1 \ +@@ -583,6 +584,7 @@ modules-names = \ + vismod1 \ + vismod2 \ + vismod3 \ ++# modules-names + + modules-names-cxx = \ + tst-dlopen-nodelete-reloc-mod1 \ +@@ -608,6 +610,7 @@ modules-names-cxx = \ + tst-unique3lib \ + tst-unique3lib2 \ + tst-unique4lib \ ++# modules-names-cxx + + modules-names += \ + $(if $(CXX),$(modules-names-cxx)) \ +@@ -617,6 +620,7 @@ modules-names += \ + $(tst-tls-many-dynamic-modules-dep-bad) \ + $(tlsmod17a-modules) \ + $(tlsmod18a-modules) \ ++# modules-names + + # Most modules build with _ISOMAC defined, but those filtered out + # depend on internal headers. diff --git a/glibc-rh2040657-3.patch b/glibc-rh2040657-3.patch new file mode 100644 index 0000000..5c63516 --- /dev/null +++ b/glibc-rh2040657-3.patch @@ -0,0 +1,171 @@ +commit 0835c0f0bad351117154b815f34f8af19ea7e325 +Author: Matt Whitlock +Date: Wed Jun 16 23:40:47 2021 -0400 + + x86: fix Autoconf caching of instruction support checks [BZ #27991] + + The Autoconf documentation for the AC_CACHE_CHECK macro states: + + The commands-to-set-it must have no side effects except for setting + the variable cache-id, see below. + + However, the tests for support of -msahf and -mmovbe were embedded in + the commands-to-set-it for lib_cv_include_x86_isa_level. This had the + consequence that libc_cv_have_x86_lahf_sahf and libc_cv_have_x86_movbe + were not defined whenever lib_cv_include_x86_isa_level was read from + cache. These variables' being undefined meant that their unquoted use + in later test expressions led to the 'test' built-in's misparsing its + arguments and emitting errors like "test: =: unexpected operator" or + "test: =: unary operator expected", depending on the particular shell. + + This commit refactors the tests for LAHF/SAHF and MOVBE instruction + support into their own AC_CACHE_CHECK macro invocations to obey the + rule that the commands-to-set-it must have no side effects other than + setting the variable named by cache-id. + + Signed-off-by: Matt Whitlock + Reviewed-by: Adhemerval Zanella + +diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure +index ead1295c38cf5f4e..62676bb686850938 100644 +--- a/sysdeps/x86/configure ++++ b/sysdeps/x86/configure +@@ -126,8 +126,6 @@ cat > conftest2.S <&5 + (eval $ac_try) 2>&5 +@@ -137,9 +135,22 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest c + count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l` + if test "$count" = 1; then + libc_cv_include_x86_isa_level=yes +- cat > conftest.c <&5 ++$as_echo "$libc_cv_include_x86_isa_level" >&6; } ++if test $libc_cv_include_x86_isa_level = yes; then ++ $as_echo "#define INCLUDE_X86_ISA_LEVEL 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LAHF/SAHF instruction support" >&5 ++$as_echo_n "checking for LAHF/SAHF instruction support... " >&6; } ++if ${libc_cv_have_x86_lahf_sahf+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ libc_cv_have_x86_lahf_sahf=no ++ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -147,7 +158,20 @@ EOF + test $ac_status = 0; }; } | grep -q "\-msahf"; then + libc_cv_have_x86_lahf_sahf=yes + fi +- if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c' ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_lahf_sahf" >&5 ++$as_echo "$libc_cv_have_x86_lahf_sahf" >&6; } ++ if test $libc_cv_have_x86_lahf_sahf = yes; then ++ $as_echo "#define HAVE_X86_LAHF_SAHF 1" >>confdefs.h ++ ++ fi ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MOVBE instruction support" >&5 ++$as_echo_n "checking for MOVBE instruction support... " >&6; } ++if ${libc_cv_have_x86_movbe+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ libc_cv_have_x86_movbe=no ++ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -155,23 +179,13 @@ EOF + test $ac_status = 0; }; } | grep -q "\-mmovbe"; then + libc_cv_have_x86_movbe=yes + fi +- fi +-fi +-rm -f conftest* +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_include_x86_isa_level" >&5 +-$as_echo "$libc_cv_include_x86_isa_level" >&6; } +-if test $libc_cv_include_x86_isa_level = yes; then +- $as_echo "#define INCLUDE_X86_ISA_LEVEL 1" >>confdefs.h +- + fi +-if test $libc_cv_have_x86_lahf_sahf = yes; then +- $as_echo "#define HAVE_X86_LAHF_SAHF 1" >>confdefs.h +- +-fi +-if test $libc_cv_have_x86_movbe = yes; then +- $as_echo "#define HAVE_X86_MOVBE 1" >>confdefs.h ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_movbe" >&5 ++$as_echo "$libc_cv_have_x86_movbe" >&6; } ++ if test $libc_cv_have_x86_movbe = yes; then ++ $as_echo "#define HAVE_X86_MOVBE 1" >>confdefs.h + ++ fi + fi + config_vars="$config_vars + enable-x86-isa-level = $libc_cv_include_x86_isa_level" +diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac +index bca97fdc2f1ac1a7..04a12ab68048cd66 100644 +--- a/sysdeps/x86/configure.ac ++++ b/sysdeps/x86/configure.ac +@@ -98,30 +98,32 @@ cat > conftest2.S < conftest.c < +Date: Fri Jan 14 16:09:20 2022 +0100 + + x86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782) + + HAVE_X86_LAHF_SAHF is implied by x86-64-v2, and HAVE_X86_MOVBE by + x86-64-v3. + + The individual flag does not appear in -fverbose-asm flag output + even if the ISA level implies it. + + Reviewed-by: H.J. Lu + +diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure +index 62676bb686850938..7bdbfdc6dc2ad38f 100644 +--- a/sysdeps/x86/configure ++++ b/sysdeps/x86/configure +@@ -155,7 +155,7 @@ else + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; } | grep -q "\-msahf"; then ++ test $ac_status = 0; }; } | grep -qE '(-msahf\b|-march=x86-64-v)'; then + libc_cv_have_x86_lahf_sahf=yes + fi + fi +@@ -176,7 +176,7 @@ else + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; } | grep -q "\-mmovbe"; then ++ test $ac_status = 0; }; } | grep -qE '(-mmovbe\b|-march=x86-64-v([3-9]|[1-9][0-9]))'; then + libc_cv_have_x86_movbe=yes + fi + fi +diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac +index 04a12ab68048cd66..10d5c2e0e555fc79 100644 +--- a/sysdeps/x86/configure.ac ++++ b/sysdeps/x86/configure.ac +@@ -110,7 +110,7 @@ if test $libc_cv_include_x86_isa_level = yes; then + AC_CACHE_CHECK([for LAHF/SAHF instruction support], + libc_cv_have_x86_lahf_sahf, [dnl + libc_cv_have_x86_lahf_sahf=no +- if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-msahf"; then ++ if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-msahf\b|-march=x86-64-v)'; then + libc_cv_have_x86_lahf_sahf=yes + fi]) + if test $libc_cv_have_x86_lahf_sahf = yes; then +@@ -119,7 +119,7 @@ if test $libc_cv_include_x86_isa_level = yes; then + AC_CACHE_CHECK([for MOVBE instruction support], + libc_cv_have_x86_movbe, [dnl + libc_cv_have_x86_movbe=no +- if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-mmovbe"; then ++ if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-mmovbe\b|-march=x86-64-v(@<:@3-9@:>@|@<:@1-9@:>@@<:@0-9@:>@))'; then + libc_cv_have_x86_movbe=yes + fi]) + if test $libc_cv_have_x86_movbe = yes; then diff --git a/glibc-rh2040657-5.patch b/glibc-rh2040657-5.patch new file mode 100644 index 0000000..bf5343e --- /dev/null +++ b/glibc-rh2040657-5.patch @@ -0,0 +1,32 @@ +commit ef7c6d42fe163a5e49a478c43e655ce4633fa5ba +Author: Florian Weimer +Date: Fri Jan 14 16:09:20 2022 +0100 + + Generate gcc-macros.h + + The file can be used to check the effect of the default compiler + flags on code generation even in areas of the build that uses + non-default compiler flags. + + Reviewed-by: H.J. Lu + +diff --git a/Makeconfig b/Makeconfig +index 8bc5540292c7b6fa..99898a632a64be91 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -1202,6 +1202,15 @@ $(common-objpfx)dl-tunable-list.stmp: \ + touch $@ + endif + ++# Dump the GCC macros used by the default compiler flags to a header ++# file, so that they can be inspected when using different compiler ++# flags. Add the GCCMACRO prefix to make these macro names unique. ++$(common-objpfx)gcc-macros.h.in: $(common-objpfx)config.status ++ $(CC) $(CFLAGS) $(CPPFLAGS) -E -dM -x c -o $@ /dev/null ++$(common-objpfx)gcc-macros.h: $(common-objpfx)gcc-macros.h.in ++ sed 's/^#define /#define GCCMACRO/' < $< > $@ ++before-compile += $(common-objpfx)gcc-macros.h ++ + # Generate version maps, but wait until sysdep-subdirs is known + ifeq ($(sysd-sorted-done),t) + ifeq ($(build-shared),yes) diff --git a/glibc-rh2040657-6.patch b/glibc-rh2040657-6.patch new file mode 100644 index 0000000..15caf1d --- /dev/null +++ b/glibc-rh2040657-6.patch @@ -0,0 +1,549 @@ +commit 7de01e60c200c431d3469deb784da8fd4508fc15 +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + elf/Makefile: Reflow and sort most variable assignments + + Reviewed-by: H.J. Lu + +Conflicts: + elf/Makefile + (Usual backporting differences. LLD support is missing + downstream.) + +diff --git a/elf/Makefile b/elf/Makefile +index 5b9c36bc6f0a3ee5..124905f96c88ab53 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -21,21 +21,62 @@ subdir := elf + + include ../Makeconfig + +-headers = elf.h bits/elfclass.h link.h bits/link.h +-routines = $(all-dl-routines) dl-support dl-iteratephdr \ +- dl-addr dl-addr-obj enbl-secure dl-profstub \ +- dl-origin dl-libc dl-sym dl-sysdep dl-error \ +- dl-reloc-static-pie libc_early_init rtld_static_init ++headers = \ ++ bits/elfclass.h \ ++ bits/link.h \ ++ elf.h \ ++ link.h \ ++ # headers ++ ++routines = \ ++ $(all-dl-routines) \ ++ dl-addr \ ++ dl-addr-obj \ ++ dl-error \ ++ dl-iteratephdr \ ++ dl-libc \ ++ dl-origin \ ++ dl-profstub \ ++ dl-reloc-static-pie \ ++ dl-support \ ++ dl-sym \ ++ dl-sysdep \ ++ enbl-secure \ ++ libc_early_init \ ++ rtld_static_init \ ++ # routines + + # The core dynamic linking functions are in libc for the static and + # profiled libraries. +-dl-routines = $(addprefix dl-,load lookup object reloc deps \ +- runtime init fini debug misc \ +- version profile tls origin scope \ +- execstack open close trampoline \ +- exception sort-maps lookup-direct \ +- call-libc-early-init write \ +- thread_gscope_wait tls_init_tp) ++dl-routines = \ ++ dl-call-libc-early-init \ ++ dl-close \ ++ dl-debug \ ++ dl-deps \ ++ dl-exception \ ++ dl-execstack \ ++ dl-fini \ ++ dl-init \ ++ dl-load \ ++ dl-lookup \ ++ dl-lookup-direct \ ++ dl-misc \ ++ dl-object \ ++ dl-open \ ++ dl-origin \ ++ dl-profile \ ++ dl-reloc \ ++ dl-runtime \ ++ dl-scope \ ++ dl-sort-maps \ ++ dl-thread_gscope_wait \ ++ dl-tls \ ++ dl-tls_init_tp \ ++ dl-trampoline \ ++ dl-version \ ++ dl-write \ ++ # dl-routines ++ + ifeq (yes,$(use-ldconfig)) + dl-routines += dl-cache + endif +@@ -58,16 +99,38 @@ endif + + all-dl-routines = $(dl-routines) $(sysdep-dl-routines) + # But they are absent from the shared libc, because that code is in ld.so. +-elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \ +- dl-sysdep dl-exception dl-reloc-static-pie \ +- thread_gscope_wait rtld_static_init ++elide-routines.os = \ ++ $(all-dl-routines) \ ++ dl-exception \ ++ dl-origin \ ++ dl-reloc-static-pie \ ++ dl-support \ ++ dl-sysdep \ ++ enbl-secure \ ++ rtld_static_init \ ++ thread_gscope_wait \ ++ # elide-routines.os + + # ld.so uses those routines, plus some special stuff for being the program + # interpreter and operating independent of libc. +-rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \ +- dl-error-minimal dl-conflict dl-hwcaps dl-hwcaps_split dl-hwcaps-subdirs \ +- dl-usage dl-diagnostics dl-diagnostics-kernel dl-diagnostics-cpu \ +- dl-mutex ++rtld-routines = \ ++ $(all-dl-routines) \ ++ dl-conflict \ ++ dl-diagnostics \ ++ dl-diagnostics-cpu \ ++ dl-diagnostics-kernel \ ++ dl-environ \ ++ dl-error-minimal \ ++ dl-hwcaps \ ++ dl-hwcaps-subdirs \ ++ dl-hwcaps_split \ ++ dl-minimal \ ++ dl-mutex \ ++ dl-sysdep \ ++ dl-usage \ ++ rtld \ ++ # rtld-routines ++ + all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines) + + CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables +@@ -102,8 +165,16 @@ ld-map = $(common-objpfx)ld.map + endif + + ifeq (yes,$(build-shared)) +-extra-objs = $(all-rtld-routines:%=%.os) sofini.os interp.os +-generated += librtld.os dl-allobjs.os ld.so ldd ++extra-objs = \ ++ $(all-rtld-routines:%=%.os) \ ++ sofini.os \ ++ interp.os \ ++ # extra-objs ++generated += \ ++ dl-allobjs.os \ ++ ld.so ldd \ ++ librtld.os \ ++ # generated + install-others = $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so + install-bin-script = ldd + endif +@@ -121,8 +192,15 @@ others-static += ldconfig + others += ldconfig + install-rootsbin += ldconfig + +-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs \ +- stringtable ++ldconfig-modules := \ ++ cache \ ++ chroot_canon \ ++ readlib \ ++ static-stubs \ ++ stringtable \ ++ xmalloc \ ++ xstrdup \ ++ # ldconfig-modules + extra-objs += $(ldconfig-modules:=.o) + others-extras = $(ldconfig-modules) + endif +@@ -156,23 +234,36 @@ $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force) + $(do-install-program) + endif + +-tests-static-normal := tst-array1-static tst-array5-static \ +- tst-dl-iter-static \ +- tst-tlsalign-static tst-tlsalign-extern-static \ +- tst-linkall-static tst-env-setuid tst-env-setuid-tunables \ +- tst-single_threaded-static tst-single_threaded-pthread-static \ +- tst-dst-static tst-getauxval-static +- +-tests-static-internal := tst-tls1-static tst-tls2-static \ +- tst-ptrguard1-static tst-stackguard1-static \ +- tst-tls1-static-non-pie ++tests-static-normal := \ ++ tst-array1-static \ ++ tst-array5-static \ ++ tst-dl-iter-static \ ++ tst-dst-static \ ++ tst-env-setuid \ ++ tst-env-setuid-tunables \ ++ tst-getauxval-static \ ++ tst-linkall-static \ ++ tst-single_threaded-pthread-static \ ++ tst-single_threaded-static \ ++ tst-tlsalign-extern-static \ ++ tst-tlsalign-static \ ++ # tests-static-normal ++ ++tests-static-internal := \ ++ tst-ptrguard1-static \ ++ tst-stackguard1-static \ ++ tst-tls1-static \ ++ tst-tls2-static \ ++ tst-tls1-static-non-pie \ ++ # tests-static-internal + + CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o + tst-tls1-static-non-pie-no-pie = yes + + tests-container := \ +- tst-ldconfig-bad-aux-cache \ +- tst-ldconfig-ld_so_conf-update ++ tst-ldconfig-bad-aux-cache \ ++ tst-ldconfig-ld_so_conf-update \ ++ # tests-container + + ifeq (no,$(build-hardcoded-path-in-tests)) + # This is an ld.so.cache test, and RPATH/RUNPATH in the executable +@@ -180,14 +271,32 @@ ifeq (no,$(build-hardcoded-path-in-tests)) + tests-container += tst-glibc-hwcaps-prepend-cache + endif + +-tests := tst-tls9 tst-leaks1 \ +- tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ +- tst-auxv tst-stringtable +-tests-internal := tst-tls1 tst-tls2 $(tests-static-internal) ++tests := \ ++ tst-array1 \ ++ tst-array2 \ ++ tst-array3 \ ++ tst-array4 \ ++ tst-array5 \ ++ tst-auxv \ ++ tst-leaks1 \ ++ tst-stringtable \ ++ tst-tls9 \ ++ # tests ++ ++tests-internal := \ ++ $(tests-static-internal) \ ++ tst-tls1 \ ++ tst-tls2 \ ++ # tests-internal ++ + tests-static := $(tests-static-normal) $(tests-static-internal) + + ifeq (yes,$(build-shared)) +-tests-static += tst-tls9-static tst-single_threaded-static-dlopen ++tests-static += \ ++ tst-single_threaded-static-dlopen \ ++ tst-tls9-static \ ++ # tests-static ++ + static-dlopen-environment = \ + LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn + tst-tls9-static-ENV = $(static-dlopen-environment) +@@ -313,33 +422,69 @@ tests += \ + unload6 \ + unload7 \ + unload8 \ +-# reldep9 ++ # tests + tests-cxx = \ + tst-dlopen-nodelete-reloc \ + tst-nodelete \ + tst-unique3 \ + tst-unique4 \ +-# tests-cxx ++ # tests-cxx + + tests += $(if $(CXX),$(tests-cxx)) +-tests-internal += loadtest unload unload2 circleload1 \ +- neededtest neededtest2 neededtest3 neededtest4 \ +- tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ +- tst-ptrguard1 tst-stackguard1 \ +- tst-create_format1 tst-tls-surplus tst-dl-hwcaps_split +-tests-container += tst-pldd tst-dlopen-tlsmodid-container \ +- tst-dlopen-self-container tst-preload-pthread-libc +-test-srcs = tst-pathopt ++ ++tests-internal += \ ++ circleload1 \ ++ loadtest \ ++ neededtest \ ++ neededtest2 \ ++ neededtest3 \ ++ neededtest4 \ ++ tst-create_format1 \ ++ tst-dl-hwcaps_split \ ++ tst-dlmopen2 \ ++ tst-ptrguard1 \ ++ tst-stackguard1 \ ++ tst-tls-surplus \ ++ tst-tls3 \ ++ tst-tls6 \ ++ tst-tls7 \ ++ tst-tls8 \ ++ unload \ ++ unload2 \ ++ # tests-internal ++ ++tests-container += \ ++ tst-dlopen-self-container \ ++ tst-dlopen-tlsmodid-container \ ++ tst-pldd \ ++ tst-preload-pthread-libc \ ++ # tests-container ++ ++test-srcs = \ ++ tst-pathopt \ ++ # tests-srcs ++ ++ifeq (yes,$(have-fpie)) ++tests-pie += tst-align3 ++endif + selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ++ + ifneq ($(selinux-enabled),1) +-tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog ++tests-execstack-yes = \ ++ tst-execstack \ ++ tst-execstack-needed \ ++ tst-execstack-prog \ ++ # tests-execstack-yes + endif + endif + tests += $(tests-execstack-$(have-z-execstack)) + ifeq ($(run-built-tests),yes) +-tests-special += $(objpfx)tst-leaks1-mem.out \ +- $(objpfx)noload-mem.out \ +- $(objpfx)tst-ldconfig-X.out $(objpfx)tst-rtld-help.out ++tests-special += \ ++ $(objpfx)noload-mem.out \ ++ $(objpfx)tst-ldconfig-X.out \ ++ $(objpfx)tst-leaks1-mem.out \ ++ $(objpfx)tst-rtld-help.out \ ++ # tests-special + endif + tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 +@@ -356,9 +501,16 @@ tst-tls-many-dynamic-modules-dep = \ + tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + tst-tls-many-dynamic-modules-dep-bad = \ + $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad) +-extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \ +- tst-tlsalign-vars.o +-test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars ++extra-test-objs += \ ++ $(tlsmod17a-modules:=.os) \ ++ $(tlsmod18a-modules:=.os) \ ++ tst-tlsalign-vars.o \ ++ # extra-test-objs ++test-extras += \ ++ tst-tlsalign-vars \ ++ tst-tlsmod17a \ ++ tst-tlsmod18a \ ++ # test-extras + modules-names = \ + circlemod1 \ + circlemod1a \ +@@ -610,17 +762,17 @@ modules-names-cxx = \ + tst-unique3lib \ + tst-unique3lib2 \ + tst-unique4lib \ +-# modules-names-cxx ++ # modules-names-cxx + + modules-names += \ + $(if $(CXX),$(modules-names-cxx)) \ + $(modules-execstack-$(have-z-execstack)) \ ++ $(tlsmod17a-modules) \ ++ $(tlsmod18a-modules) \ + $(tst-tls-many-dynamic-modules) \ + $(tst-tls-many-dynamic-modules-dep) \ + $(tst-tls-many-dynamic-modules-dep-bad) \ +- $(tlsmod17a-modules) \ +- $(tlsmod18a-modules) \ +-# modules-names ++ # modules-names + + # Most modules build with _ISOMAC defined, but those filtered out + # depend on internal headers. +@@ -669,35 +821,70 @@ modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod + tests += $(tests-static) + + ifeq (yes,$(have-ifunc)) +-tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \ +- ifuncmain2static ifuncmain2picstatic \ +- ifuncmain4static ifuncmain4picstatic \ +- ifuncmain5static ifuncmain5picstatic \ +- ifuncmain7static ifuncmain7picstatic ++tests-ifuncstatic := \ ++ ifuncmain1static \ ++ ifuncmain1picstatic \ ++ ifuncmain2static \ ++ ifuncmain2picstatic \ ++ ifuncmain4static \ ++ ifuncmain4picstatic \ ++ ifuncmain5static \ ++ ifuncmain5picstatic \ ++ ifuncmain7static \ ++ ifuncmain7picstatic \ ++ # tests-ifuncstatic + ifeq (yes,$(have-gcc-ifunc)) + tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic + endif + tests-static += $(tests-ifuncstatic) + tests-internal += $(tests-ifuncstatic) + ifeq (yes,$(build-shared)) +-tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow ++tests += \ ++ tst-ifunc-fault-bindnow \ ++ tst-ifunc-fault-lazy \ ++ # tests + # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8. + tests-internal += \ +- ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ +- ifuncmain1staticpic \ +- ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \ +- ifuncmain5 ifuncmain5pic ifuncmain5staticpic \ +- ifuncmain7 ifuncmain7pic ++ ifuncmain1 \ ++ ifuncmain1pic \ ++ ifuncmain1staticpic \ ++ ifuncmain1vis \ ++ ifuncmain1vispic \ ++ ifuncmain2 \ ++ ifuncmain2pic \ ++ ifuncmain3 \ ++ ifuncmain4 \ ++ ifuncmain5 \ ++ ifuncmain5pic \ ++ ifuncmain5staticpic \ ++ ifuncmain7 \ ++ ifuncmain7pic \ ++ # tests-internal + ifeq (yes,$(have-gcc-ifunc)) +-tests-internal += ifuncmain9 ifuncmain9pic ++tests-internal += \ ++ ifuncmain9 \ ++ ifuncmain9pic \ ++ # tests-internal + endif +-ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \ +- ifuncdep5 ifuncdep5pic ++ifunc-test-modules = \ ++ ifuncdep1 \ ++ ifuncdep1pic \ ++ ifuncdep2 \ ++ ifuncdep2pic \ ++ ifuncdep5 \ ++ ifuncdep5pic \ ++ # ifunc-test-modules + extra-test-objs += $(ifunc-test-modules:=.o) + test-internal-extras += $(ifunc-test-modules) + ifeq (yes,$(have-fpie)) +-ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \ +- ifuncmain5pie ifuncmain6pie ifuncmain7pie ++ifunc-pie-tests = \ ++ ifuncmain1pie \ ++ ifuncmain1staticpie \ ++ ifuncmain1vispie \ ++ ifuncmain5pie \ ++ ifuncmain6pie \ ++ ifuncmain7pie \ ++ # ifunc-pie-tests + ifeq (yes,$(have-gcc-ifunc)) + ifunc-pie-tests += ifuncmain9pie + endif +@@ -707,30 +894,50 @@ endif + tests-internal += $(ifunc-pie-tests) + tests-pie += $(ifunc-pie-tests) + endif +-modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6 ++modules-names += \ ++ ifuncmod1 \ ++ ifuncmod3 \ ++ ifuncmod5 \ ++ ifuncmod6 \ ++ # module-names + endif + endif + + ifeq (yes,$(build-shared)) + ifeq ($(run-built-tests),yes) +-tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \ +- $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out \ +- $(objpfx)tst-rtld-help.out ++tests-special += \ ++ $(objpfx)argv0test.out \ ++ $(objpfx)tst-pathopt.out \ ++ $(objpfx)tst-rtld-help.out \ ++ $(objpfx)tst-rtld-load-self.out \ ++ $(objpfx)tst-rtld-preload.out \ ++ # tests-special + endif +-tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \ +- $(objpfx)check-wx-segment.out \ +- $(objpfx)check-localplt.out $(objpfx)check-initfini.out ++tests-special += \ ++ $(objpfx)check-execstack.out \ ++ $(objpfx)check-initfini.out \ ++ $(objpfx)check-localplt.out \ ++ $(objpfx)check-textrel.out \ ++ $(objpfx)check-wx-segment.out \ ++ # tests-special + endif + + ifeq ($(run-built-tests),yes) +-tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ +- $(objpfx)tst-array1-static-cmp.out \ +- $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \ +- $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \ +- $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \ +- $(objpfx)tst-initorder-cmp.out \ +- $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \ +- $(objpfx)tst-unused-dep-cmp.out ++tests-special += \ ++ $(objpfx)order-cmp.out \ ++ $(objpfx)order2-cmp.out \ ++ $(objpfx)tst-array1-cmp.out \ ++ $(objpfx)tst-array1-static-cmp.out \ ++ $(objpfx)tst-array2-cmp.out \ ++ $(objpfx)tst-array3-cmp.out \ ++ $(objpfx)tst-array4-cmp.out \ ++ $(objpfx)tst-array5-cmp.out \ ++ $(objpfx)tst-array5-static-cmp.out \ ++ $(objpfx)tst-initorder-cmp.out \ ++ $(objpfx)tst-initorder2-cmp.out \ ++ $(objpfx)tst-unused-dep-cmp.out \ ++ $(objpfx)tst-unused-dep.out \ ++ # tests-special + endif + + ifndef avoid-generated +@@ -835,6 +1042,7 @@ rtld-stubbed-symbols = \ + free \ + malloc \ + realloc \ ++ # rtld-stubbed-symbols + + ifeq ($(have-ssp),yes) + # rtld is not built with the stack protector, so these references will diff --git a/glibc-rh2040657-7.patch b/glibc-rh2040657-7.patch new file mode 100644 index 0000000..1189326 --- /dev/null +++ b/glibc-rh2040657-7.patch @@ -0,0 +1,633 @@ +commit b693d75f0c611bce9b0ad984bad306121d42c535 +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + elf: Split dl-printf.c from dl-misc.c + + This allows to use different compiler flags for the diagnostics + code. + + Reviewed-by: H.J. Lu + +diff --git a/elf/Makefile b/elf/Makefile +index 124905f96c88ab53..52aafc89cec835ab 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -64,6 +64,7 @@ dl-routines = \ + dl-object \ + dl-open \ + dl-origin \ ++ dl-printf \ + dl-profile \ + dl-reloc \ + dl-runtime \ +diff --git a/elf/dl-misc.c b/elf/dl-misc.c +index b256d792c6198683..f17140b129343f7b 100644 +--- a/elf/dl-misc.c ++++ b/elf/dl-misc.c +@@ -16,24 +16,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#include ++#include <_itoa.h> + #include + #include +-#include + #include +-#include +-#include +-#include +-#include ++#include + #include ++#include + #include +-#include + #include +-#include +-#include +-#include <_itoa.h> +-#include +-#include ++#include + + /* Read the whole contents of FILE into new mmap'd space with given + protections. *SIZEP gets the size of the file. On error MAP_FAILED +@@ -70,270 +62,6 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) + return result; + } + +- +-/* Bare-bones printf implementation. This function only knows about +- the formats and flags needed and can handle only up to 64 stripes in +- the output. */ +-static void +-_dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) +-{ +-# define NIOVMAX 64 +- struct iovec iov[NIOVMAX]; +- int niov = 0; +- pid_t pid = 0; +- char pidbuf[12]; +- +- while (*fmt != '\0') +- { +- const char *startp = fmt; +- +- if (tag_p > 0) +- { +- /* Generate the tag line once. It consists of the PID and a +- colon followed by a tab. */ +- if (pid == 0) +- { +- char *p; +- pid = __getpid (); +- assert (pid >= 0 && sizeof (pid_t) <= 4); +- p = _itoa (pid, &pidbuf[10], 10, 0); +- while (p > pidbuf) +- *--p = ' '; +- pidbuf[10] = ':'; +- pidbuf[11] = '\t'; +- } +- +- /* Append to the output. */ +- assert (niov < NIOVMAX); +- iov[niov].iov_len = 12; +- iov[niov++].iov_base = pidbuf; +- +- /* No more tags until we see the next newline. */ +- tag_p = -1; +- } +- +- /* Skip everything except % and \n (if tags are needed). */ +- while (*fmt != '\0' && *fmt != '%' && (! tag_p || *fmt != '\n')) +- ++fmt; +- +- /* Append constant string. */ +- assert (niov < NIOVMAX); +- if ((iov[niov].iov_len = fmt - startp) != 0) +- iov[niov++].iov_base = (char *) startp; +- +- if (*fmt == '%') +- { +- /* It is a format specifier. */ +- char fill = ' '; +- int width = -1; +- int prec = -1; +-#if LONG_MAX != INT_MAX +- int long_mod = 0; +-#endif +- +- /* Recognize zero-digit fill flag. */ +- if (*++fmt == '0') +- { +- fill = '0'; +- ++fmt; +- } +- +- /* See whether with comes from a parameter. Note that no other +- way to specify the width is implemented. */ +- if (*fmt == '*') +- { +- width = va_arg (arg, int); +- ++fmt; +- } +- +- /* Handle precision. */ +- if (*fmt == '.' && fmt[1] == '*') +- { +- prec = va_arg (arg, int); +- fmt += 2; +- } +- +- /* Recognize the l modifier. It is only important on some +- platforms where long and int have a different size. We +- can use the same code for size_t. */ +- if (*fmt == 'l' || *fmt == 'Z') +- { +-#if LONG_MAX != INT_MAX +- long_mod = 1; +-#endif +- ++fmt; +- } +- +- switch (*fmt) +- { +- /* Integer formatting. */ +- case 'd': +- case 'u': +- case 'x': +- { +- /* We have to make a difference if long and int have a +- different size. */ +-#if LONG_MAX != INT_MAX +- unsigned long int num = (long_mod +- ? va_arg (arg, unsigned long int) +- : va_arg (arg, unsigned int)); +-#else +- unsigned long int num = va_arg (arg, unsigned int); +-#endif +- bool negative = false; +- if (*fmt == 'd') +- { +-#if LONG_MAX != INT_MAX +- if (long_mod) +- { +- if ((long int) num < 0) +- negative = true; +- } +- else +- { +- if ((int) num < 0) +- { +- num = (unsigned int) num; +- negative = true; +- } +- } +-#else +- if ((int) num < 0) +- negative = true; +-#endif +- } +- +- /* We use alloca() to allocate the buffer with the most +- pessimistic guess for the size. Using alloca() allows +- having more than one integer formatting in a call. */ +- char *buf = (char *) alloca (1 + 3 * sizeof (unsigned long int)); +- char *endp = &buf[1 + 3 * sizeof (unsigned long int)]; +- char *cp = _itoa (num, endp, *fmt == 'x' ? 16 : 10, 0); +- +- /* Pad to the width the user specified. */ +- if (width != -1) +- while (endp - cp < width) +- *--cp = fill; +- +- if (negative) +- *--cp = '-'; +- +- iov[niov].iov_base = cp; +- iov[niov].iov_len = endp - cp; +- ++niov; +- } +- break; +- +- case 's': +- /* Get the string argument. */ +- iov[niov].iov_base = va_arg (arg, char *); +- iov[niov].iov_len = strlen (iov[niov].iov_base); +- if (prec != -1) +- iov[niov].iov_len = MIN ((size_t) prec, iov[niov].iov_len); +- ++niov; +- break; +- +- case '%': +- iov[niov].iov_base = (void *) fmt; +- iov[niov].iov_len = 1; +- ++niov; +- break; +- +- default: +- assert (! "invalid format specifier"); +- } +- ++fmt; +- } +- else if (*fmt == '\n') +- { +- /* See whether we have to print a single newline character. */ +- if (fmt == startp) +- { +- iov[niov].iov_base = (char *) startp; +- iov[niov++].iov_len = 1; +- } +- else +- /* No, just add it to the rest of the string. */ +- ++iov[niov - 1].iov_len; +- +- /* Next line, print a tag again. */ +- tag_p = 1; +- ++fmt; +- } +- } +- +- /* Finally write the result. */ +- _dl_writev (fd, iov, niov); +-} +- +- +-/* Write to debug file. */ +-void +-_dl_debug_printf (const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (GLRO(dl_debug_fd), 1, fmt, arg); +- va_end (arg); +-} +- +- +-/* Write to debug file but don't start with a tag. */ +-void +-_dl_debug_printf_c (const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (GLRO(dl_debug_fd), -1, fmt, arg); +- va_end (arg); +-} +- +- +-/* Write the given file descriptor. */ +-void +-_dl_dprintf (int fd, const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (fd, 0, fmt, arg); +- va_end (arg); +-} +- +-void +-_dl_printf (const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (STDOUT_FILENO, 0, fmt, arg); +- va_end (arg); +-} +- +-void +-_dl_error_printf (const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg); +- va_end (arg); +-} +- +-void +-_dl_fatal_printf (const char *fmt, ...) +-{ +- va_list arg; +- +- va_start (arg, fmt); +- _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg); +- va_end (arg); +- _exit (127); +-} +-rtld_hidden_def (_dl_fatal_printf) +- + /* Test whether given NAME matches any of the names of the given object. */ + int + _dl_name_match_p (const char *name, const struct link_map *map) +@@ -354,7 +82,6 @@ _dl_name_match_p (const char *name, const struct link_map *map) + return 0; + } + +- + unsigned long int + _dl_higher_prime_number (unsigned long int n) + { +diff --git a/elf/dl-printf.c b/elf/dl-printf.c +new file mode 100644 +index 0000000000000000..d3264ba96cd959bf +--- /dev/null ++++ b/elf/dl-printf.c +@@ -0,0 +1,292 @@ ++/* printf implementation for the dynamic loader. ++ Copyright (C) 1997-2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include <_itoa.h> ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Bare-bones printf implementation. This function only knows about ++ the formats and flags needed and can handle only up to 64 stripes in ++ the output. */ ++static void ++_dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) ++{ ++# define NIOVMAX 64 ++ struct iovec iov[NIOVMAX]; ++ int niov = 0; ++ pid_t pid = 0; ++ char pidbuf[12]; ++ ++ while (*fmt != '\0') ++ { ++ const char *startp = fmt; ++ ++ if (tag_p > 0) ++ { ++ /* Generate the tag line once. It consists of the PID and a ++ colon followed by a tab. */ ++ if (pid == 0) ++ { ++ char *p; ++ pid = __getpid (); ++ assert (pid >= 0 && sizeof (pid_t) <= 4); ++ p = _itoa (pid, &pidbuf[10], 10, 0); ++ while (p > pidbuf) ++ *--p = ' '; ++ pidbuf[10] = ':'; ++ pidbuf[11] = '\t'; ++ } ++ ++ /* Append to the output. */ ++ assert (niov < NIOVMAX); ++ iov[niov].iov_len = 12; ++ iov[niov++].iov_base = pidbuf; ++ ++ /* No more tags until we see the next newline. */ ++ tag_p = -1; ++ } ++ ++ /* Skip everything except % and \n (if tags are needed). */ ++ while (*fmt != '\0' && *fmt != '%' && (! tag_p || *fmt != '\n')) ++ ++fmt; ++ ++ /* Append constant string. */ ++ assert (niov < NIOVMAX); ++ if ((iov[niov].iov_len = fmt - startp) != 0) ++ iov[niov++].iov_base = (char *) startp; ++ ++ if (*fmt == '%') ++ { ++ /* It is a format specifier. */ ++ char fill = ' '; ++ int width = -1; ++ int prec = -1; ++#if LONG_MAX != INT_MAX ++ int long_mod = 0; ++#endif ++ ++ /* Recognize zero-digit fill flag. */ ++ if (*++fmt == '0') ++ { ++ fill = '0'; ++ ++fmt; ++ } ++ ++ /* See whether with comes from a parameter. Note that no other ++ way to specify the width is implemented. */ ++ if (*fmt == '*') ++ { ++ width = va_arg (arg, int); ++ ++fmt; ++ } ++ ++ /* Handle precision. */ ++ if (*fmt == '.' && fmt[1] == '*') ++ { ++ prec = va_arg (arg, int); ++ fmt += 2; ++ } ++ ++ /* Recognize the l modifier. It is only important on some ++ platforms where long and int have a different size. We ++ can use the same code for size_t. */ ++ if (*fmt == 'l' || *fmt == 'Z') ++ { ++#if LONG_MAX != INT_MAX ++ long_mod = 1; ++#endif ++ ++fmt; ++ } ++ ++ switch (*fmt) ++ { ++ /* Integer formatting. */ ++ case 'd': ++ case 'u': ++ case 'x': ++ { ++ /* We have to make a difference if long and int have a ++ different size. */ ++#if LONG_MAX != INT_MAX ++ unsigned long int num = (long_mod ++ ? va_arg (arg, unsigned long int) ++ : va_arg (arg, unsigned int)); ++#else ++ unsigned long int num = va_arg (arg, unsigned int); ++#endif ++ bool negative = false; ++ if (*fmt == 'd') ++ { ++#if LONG_MAX != INT_MAX ++ if (long_mod) ++ { ++ if ((long int) num < 0) ++ negative = true; ++ } ++ else ++ { ++ if ((int) num < 0) ++ { ++ num = (unsigned int) num; ++ negative = true; ++ } ++ } ++#else ++ if ((int) num < 0) ++ negative = true; ++#endif ++ } ++ ++ /* We use alloca() to allocate the buffer with the most ++ pessimistic guess for the size. Using alloca() allows ++ having more than one integer formatting in a call. */ ++ char *buf = (char *) alloca (1 + 3 * sizeof (unsigned long int)); ++ char *endp = &buf[1 + 3 * sizeof (unsigned long int)]; ++ char *cp = _itoa (num, endp, *fmt == 'x' ? 16 : 10, 0); ++ ++ /* Pad to the width the user specified. */ ++ if (width != -1) ++ while (endp - cp < width) ++ *--cp = fill; ++ ++ if (negative) ++ *--cp = '-'; ++ ++ iov[niov].iov_base = cp; ++ iov[niov].iov_len = endp - cp; ++ ++niov; ++ } ++ break; ++ ++ case 's': ++ /* Get the string argument. */ ++ iov[niov].iov_base = va_arg (arg, char *); ++ iov[niov].iov_len = strlen (iov[niov].iov_base); ++ if (prec != -1) ++ iov[niov].iov_len = MIN ((size_t) prec, iov[niov].iov_len); ++ ++niov; ++ break; ++ ++ case '%': ++ iov[niov].iov_base = (void *) fmt; ++ iov[niov].iov_len = 1; ++ ++niov; ++ break; ++ ++ default: ++ assert (! "invalid format specifier"); ++ } ++ ++fmt; ++ } ++ else if (*fmt == '\n') ++ { ++ /* See whether we have to print a single newline character. */ ++ if (fmt == startp) ++ { ++ iov[niov].iov_base = (char *) startp; ++ iov[niov++].iov_len = 1; ++ } ++ else ++ /* No, just add it to the rest of the string. */ ++ ++iov[niov - 1].iov_len; ++ ++ /* Next line, print a tag again. */ ++ tag_p = 1; ++ ++fmt; ++ } ++ } ++ ++ /* Finally write the result. */ ++ _dl_writev (fd, iov, niov); ++} ++ ++ ++/* Write to debug file. */ ++void ++_dl_debug_printf (const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (GLRO(dl_debug_fd), 1, fmt, arg); ++ va_end (arg); ++} ++ ++ ++/* Write to debug file but don't start with a tag. */ ++void ++_dl_debug_printf_c (const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (GLRO(dl_debug_fd), -1, fmt, arg); ++ va_end (arg); ++} ++ ++ ++/* Write the given file descriptor. */ ++void ++_dl_dprintf (int fd, const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (fd, 0, fmt, arg); ++ va_end (arg); ++} ++ ++void ++_dl_printf (const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (STDOUT_FILENO, 0, fmt, arg); ++ va_end (arg); ++} ++ ++void ++_dl_error_printf (const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg); ++ va_end (arg); ++} ++ ++void ++_dl_fatal_printf (const char *fmt, ...) ++{ ++ va_list arg; ++ ++ va_start (arg, fmt); ++ _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg); ++ va_end (arg); ++ _exit (127); ++} ++rtld_hidden_def (_dl_fatal_printf) diff --git a/glibc-rh2040657-8.patch b/glibc-rh2040657-8.patch new file mode 100644 index 0000000..7eabbc4 --- /dev/null +++ b/glibc-rh2040657-8.patch @@ -0,0 +1,146 @@ +commit 9ba202c78f0aa39f49929eee63c367847da72ee4 +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + Add --with-rtld-early-cflags configure option + + Reviewed-by: H.J. Lu + Reviewed-by: Carlos O'Donell + +Conflicts: + INSTALL + configure + manual/install.texi + (Missing --with-timeout-factor downstream.) + +diff --git a/INSTALL b/INSTALL +index d6d93ec9be4262d7..d8d4e9f155f56616 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -106,6 +106,14 @@ if 'CFLAGS' is specified it must enable optimization. For example: + particular case and potentially change debugging information and + metadata only). + ++'--with-rtld-early-cflags=CFLAGS' ++ Use additional compiler flags CFLAGS to build the early startup ++ code of the dynamic linker. These flags can be used to enable ++ early dynamic linker diagnostics to run on CPUs which are not ++ compatible with the rest of the GNU C Library, for example, due to ++ compiler flags which target a later instruction set architecture ++ (ISA). ++ + '--disable-shared' + Don't build shared libraries even if it is possible. Not all + systems support shared libraries; you need ELF support and +diff --git a/config.make.in b/config.make.in +index e8630a8d0ccf874d..6d43e691f7823262 100644 +--- a/config.make.in ++++ b/config.make.in +@@ -110,6 +110,7 @@ CFLAGS = @CFLAGS@ + CPPFLAGS-config = @CPPFLAGS@ + CPPUNDEFS = @CPPUNDEFS@ + extra-nonshared-cflags = @extra_nonshared_cflags@ ++rtld-early-cflags = @rtld_early_cflags@ + ASFLAGS-config = @ASFLAGS_config@ + AR = @AR@ + NM = @NM@ +diff --git a/configure b/configure +index e9d2b1f398c4dba0..03f4e59e754b5463 100755 +--- a/configure ++++ b/configure +@@ -681,6 +681,7 @@ force_install + bindnow + hardcoded_path_in_tests + enable_timezone_tools ++rtld_early_cflags + extra_nonshared_cflags + use_default_link + sysheaders +@@ -761,6 +762,7 @@ with_selinux + with_headers + with_default_link + with_nonshared_cflags ++with_rtld_early_cflags + enable_sanity_checks + enable_shared + enable_profile +@@ -1479,6 +1481,8 @@ Optional Packages: + --with-default-link do not use explicit linker scripts + --with-nonshared-cflags=CFLAGS + build nonshared libraries with additional CFLAGS ++ --with-rtld-early-cflags=CFLAGS ++ build early initialization with additional CFLAGS + --with-cpu=CPU select code for CPU variant + + Some influential environment variables: +@@ -3383,6 +3387,16 @@ fi + + + ++# Check whether --with-rtld-early-cflags was given. ++if test "${with_rtld_early_cflags+set}" = set; then : ++ withval=$with_rtld_early_cflags; rtld_early_cflags=$withval ++else ++ rtld_early_cflags= ++fi ++ ++ ++ ++ + # Check whether --enable-sanity-checks was given. + if test "${enable_sanity_checks+set}" = set; then : + enableval=$enable_sanity_checks; enable_sanity=$enableval +diff --git a/configure.ac b/configure.ac +index 79f6822d29ce21cf..eb9431875fae1b0e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -162,6 +162,12 @@ AC_ARG_WITH([nonshared-cflags], + [extra_nonshared_cflags=$withval], + [extra_nonshared_cflags=]) + AC_SUBST(extra_nonshared_cflags) ++AC_ARG_WITH([rtld-early-cflags], ++ AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS], ++ [build early initialization with additional CFLAGS]), ++ [rtld_early_cflags=$withval], ++ [rtld_early_cflags=]) ++AC_SUBST(rtld_early_cflags) + + AC_ARG_ENABLE([sanity-checks], + AS_HELP_STRING([--disable-sanity-checks], +diff --git a/elf/Makefile b/elf/Makefile +index 52aafc89cec835ab..778e393395fc5248 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -152,6 +152,14 @@ CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os)) + CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os)) + CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines)) + ++# Add the requested compiler flags to the early startup code. ++CFLAGS-dl-printf.os += $(rtld-early-cflags) ++CFLAGS-dl-sysdep.os += $(rtld-early-cflags) ++CFLAGS-dl-tunables.os += $(rtld-early-cflags) ++CFLAGS-dl-write.os += $(rtld-early-cflags) ++CFLAGS-dl-writev.os += $(rtld-early-cflags) ++CFLAGS-rtld.os += $(rtld-early-cflags) ++ + ifeq ($(unwind-find-fde),yes) + routines += unwind-dw2-fde-glibc + shared-only-routines += unwind-dw2-fde-glibc +diff --git a/manual/install.texi b/manual/install.texi +index 1320ac69b3c645f2..816b77a0a25a88a7 100644 +--- a/manual/install.texi ++++ b/manual/install.texi +@@ -131,6 +131,13 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag + (although this will not affect the generated code in this particular + case and potentially change debugging information and metadata only). + ++@item --with-rtld-early-cflags=@var{cflags} ++Use additional compiler flags @var{cflags} to build the early startup ++code of the dynamic linker. These flags can be used to enable early ++dynamic linker diagnostics to run on CPUs which are not compatible with ++the rest of @theglibc{}, for example, due to compiler flags which target ++a later instruction set architecture (ISA). ++ + @c disable static doesn't work currently + @c @item --disable-static + @c Don't build static libraries. Static libraries aren't that useful these diff --git a/glibc-rh2040657-9.patch b/glibc-rh2040657-9.patch new file mode 100644 index 0000000..1908c6f --- /dev/null +++ b/glibc-rh2040657-9.patch @@ -0,0 +1,52 @@ +commit 550116486692efc394d03befee19f7e9c17d5044 +Author: Florian Weimer +Date: Fri Jan 14 20:16:05 2022 +0100 + + powerpc64le: Use in early HWCAP check + + This is required so that the checks still work if $(early-cflags) + selects a different ISA level. + + Reviewed-by: Carlos O'Donell + Tested-by: Carlos O'Donell + +diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h +index 0437ae4d522fb36d..899c74f880e6f5f0 100644 +--- a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h ++++ b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h +@@ -19,17 +19,18 @@ + #ifndef _DL_HWCAP_CHECK_H + #define _DL_HWCAP_CHECK_H + ++#include + #include + + static inline void + dl_hwcap_check (void) + { +-#ifdef _ARCH_PWR9 ++#ifdef GCCMACRO_ARCH_PWR9 + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_00) == 0) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)\n"); + #endif +-#ifdef __FLOAT128_HARDWARE__ ++#ifdef GCCMACRO__FLOAT128_HARDWARE__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_IEEE128) == 0) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks float128 support (POWER 9 or later required)\n"); +@@ -37,12 +38,12 @@ Fatal glibc error: CPU lacks float128 support (POWER 9 or later required)\n"); + /* This check is not actually reached when building for POWER10 and + running on POWER9 because there are faulting PCREL instructions + before this point. */ +-#if defined _ARCH_PWR10 || defined __PCREL__ ++#if defined GCCMACRO_ARCH_PWR10 || defined GCCMACRO__PCREL__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_1) == 0) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks ISA 3.10 support (POWER10 or later required)\n"); + #endif +-#ifdef __MMA__ ++#ifdef GCCMACRO__MMA__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_MMA) == 0) + _dl_fatal_printf ("\ + Fatal glibc error: CPU lacks MMA support (POWER10 or later required)\n"); diff --git a/glibc.spec b/glibc.spec index c097719..9fc6964 100644 --- a/glibc.spec +++ b/glibc.spec @@ -148,7 +148,7 @@ end \ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 19%{?dist} +Release: 20%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -326,6 +326,18 @@ Patch126: glibc-rh2024347-10.patch Patch127: glibc-rh2024347-11.patch Patch128: glibc-rh2024347-12.patch Patch129: glibc-rh2024347-13.patch +Patch130: glibc-rh2040657-1.patch +Patch131: glibc-rh2040657-2.patch +Patch132: glibc-rh2040657-3.patch +Patch133: glibc-rh2040657-4.patch +Patch134: glibc-rh2040657-5.patch +Patch135: glibc-rh2040657-6.patch +Patch136: glibc-rh2040657-7.patch +Patch137: glibc-rh2040657-8.patch +Patch138: glibc-rh2040657-9.patch +Patch139: glibc-rh2040657-10.patch +Patch140: glibc-rh2040657-11.patch +Patch141: glibc-rh2040657-12.patch ############################################################################## # Continued list of core "glibc" package information: @@ -1242,6 +1254,20 @@ rpm_inherit_flags \ "-mtune=zEC12" \ "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \ +# Use the RHEL 8 baseline for the early dynamic loader code, so that +# running on too old CPUs results in a diagnostic. +%if 0%{?rhel} >= 9 +%ifarch ppc64le +%define glibc_rtld_early_cflags -mcpu=power8 +%endif +%ifarch s390x +%define glibc_rtld_early_cflags -march=z13 +%endif +%ifarch x86_64 +%define glibc_rtld_early_cflags -march=x86-64 +%endif +%endif + # libc_nonshared.a cannot be built with the default hardening flags # because the glibc build system is incompatible with # -D_FORTIFY_SOURCE. The object files need to be marked as to be @@ -1288,6 +1314,7 @@ build() --enable-tunables \ --enable-systemtap \ ${core_with_options} \ + %{?glibc_rtld_early_cflags:--with-rtld-early-cflags=%glibc_rtld_early_cflags} \ %ifarch x86_64 %{ix86} --enable-cet \ %endif @@ -2354,6 +2381,9 @@ fi %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Wed Jan 19 2022 Florian Weimer - 2.34-20 +- More reliable CPU compatibility diagnostics (#2040657) + * Fri Jan 14 2022 Florian Weimer - 2.34-19 - Optionally accelerate sched_getcpu using rseq (#2024347)