From patchwork Fri Jan 14 16:52:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50039 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDD6A387741E for ; Fri, 14 Jan 2022 16:53:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDD6A387741E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179193; bh=IJJabnYzIpWu+nGZJxaodESOi0xmw8gYzBk6rGWrK+k=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vw0AugAGV6GlG5zFEXae+b0BMGA/z/EcOF5aZYH3HyjdJ0yC8dck2V+kUAy4AgS5V qQGcKTx5Xub/Vq8lB+Kzu+dvpt3ZPEB2cSc/8AlkO4QL2NEU382HdfkZZnpRsOM1K7 lXFipeJDgQOuVlW98aF7a2+jxgZ3mqlRPVtFdepE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8D4013836015 for ; Fri, 14 Jan 2022 16:52:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D4013836015 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-B_8EEoaUMHeUhqDRKrAcMA-1; Fri, 14 Jan 2022 11:52:15 -0500 X-MC-Unique: B_8EEoaUMHeUhqDRKrAcMA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B1BA39347 for ; Fri, 14 Jan 2022 16:52:13 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 928AD7EFC0 for ; Fri, 14 Jan 2022 16:52:12 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 1/6] elf/Makefile: Reflow and sort most variable assignments In-Reply-To: References: X-From-Line: ce7b38f2c34d651ecbc84da09aa91f711f79394d Mon Sep 17 00:00:00 2001 Message-Id: Date: Fri, 14 Jan 2022 17:52:10 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" --- v2: new patch elf/Makefile | 420 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 318 insertions(+), 102 deletions(-) Reviewed-by: H.J. Lu diff --git a/elf/Makefile b/elf/Makefile index b86d116be9..3065efc485 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -21,24 +21,67 @@ subdir := elf include ../Makeconfig -headers = elf.h bits/elfclass.h link.h bits/link.h bits/link_lavcurrent.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 \ - libc-dl_find_object +headers = \ + bits/elfclass.h \ + bits/link.h \ + bits/link_lavcurrent.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-dl_find_object \ + 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 \ - debug-symbols minimal-malloc \ - find_object) +dl-routines = \ + dl-call-libc-early-init \ + dl-close \ + dl-debug \ + dl-debug-symbols \ + dl-deps \ + dl-exception \ + dl-execstack \ + dl-find_object \ + dl-fini \ + dl-init \ + dl-load \ + dl-lookup \ + dl-lookup-direct \ + dl-minimal-malloc \ + 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 @@ -61,19 +104,43 @@ 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 # These object files are only included in the dynamically-linked libc. shared-only-routines = libc-dl_find_object # 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 dl-libc_freeres dl-audit +rtld-routines = \ + $(all-dl-routines) \ + dl-audit \ + dl-conflict \ + dl-diagnostics \ + dl-diagnostics-cpu \ + dl-diagnostics-kernel \ + dl-environ \ + dl-error-minimal \ + dl-hwcaps \ + dl-hwcaps-subdirs \ + dl-hwcaps_split \ + dl-libc_freeres \ + 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 @@ -113,8 +180,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 @@ -132,8 +207,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 @@ -167,24 +249,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-ptrguard1-static tst-stackguard1-static \ - tst-tls1-static-non-pie \ - tst-dl_find_object-static +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-dl_find_object-static \ + tst-ptrguard1-static \ + tst-stackguard1-static \ + tst-tls1-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 @@ -192,14 +286,31 @@ 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 $(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 \ + # 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) @@ -327,45 +438,88 @@ 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 \ - tst-audit19a \ - tst-dl_find_object tst-dl_find_object-threads -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-audit19a \ + tst-create_format1 \ + tst-dl-hwcaps_split \ + tst-dl_find_object \ + tst-dl_find_object-threads \ + 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 ifeq ($(have-depaudit),yes) -tests += tst-audit14 tst-audit15 tst-audit16 tst-audit14a +tests += \ + tst-audit14 \ + tst-audit14a \ + tst-audit15 \ + tst-audit16 \ + # tests ifeq ($(run-built-tests),yes) -tests-special += $(objpfx)tst-audit14-cmp.out $(objpfx)tst-audit15-cmp.out \ - $(objpfx)tst-audit16-cmp.out $(objpfx)tst-audit14a-cmp.out +tests-special += \ + $(objpfx)tst-audit14-cmp.out \ + $(objpfx)tst-audit14a-cmp.out \ + $(objpfx)tst-audit15-cmp.out \ + $(objpfx)tst-audit16-cmp.out \ + # tests-special endif 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 @@ -382,9 +536,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 \ @@ -653,17 +814,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. @@ -728,38 +889,73 @@ 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 += \ - ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ - ifuncmain1staticpic \ - ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \ - ifuncmain5staticpic \ - ifuncmain7 ifuncmain7pic + ifuncmain1pic \ + ifuncmain1staticpic \ + ifuncmain1vis \ + ifuncmain1vispic \ + ifuncmain2 \ + ifuncmain2pic \ + ifuncmain3 \ + ifuncmain4 \ + ifuncmain5staticpic \ + ifuncmain7 \ + ifuncmain7pic \ + # tests-internal ifeq (no,$(with-lld)) -tests-internal += ifuncmain1 ifuncmain5 ifuncmain5pic +tests-internal += \ + ifuncmain1 \ + ifuncmain5 \ + ifuncmain5pic \ + # tests-internal endif 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 \ - ifuncmain6pie ifuncmain7pie +ifunc-pie-tests = \ + ifuncmain1pie \ + ifuncmain1staticpie \ + ifuncmain1vispie \ + ifuncmain6pie \ + ifuncmain7pie \ + # ifunc-pie-tests ifeq (yes,$(have-gcc-ifunc)) ifunc-pie-tests += ifuncmain9pie endif @@ -772,7 +968,11 @@ endif tests-internal += $(ifunc-pie-tests) tests-pie += $(ifunc-pie-tests) endif -modules-names += ifuncmod1 ifuncmod3 ifuncmod6 +modules-names += \ + ifuncmod1 \ + ifuncmod3 \ + ifuncmod6 \ + # module-names ifeq (no,$(with-lld)) modules-names += ifuncmod5 endif @@ -781,24 +981,39 @@ 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 @@ -903,6 +1118,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 From patchwork Fri Jan 14 16:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50040 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3831D3836015 for ; Fri, 14 Jan 2022 16:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3831D3836015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179236; bh=ut0mdEsToHLlv7senp1y15nJc10R16e92M3nzCFnfsg=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=OxHVIIxDPhrFLbVJz9l1js2jRjaucIUH6Jk8t/pKctDySC0AI61CxtFHR322mCPxZ W4nEwwBD3MOQ8B13+sPdd9es7owlC1L1gHDt9J/WfE6ktqHwqRBH+cIsF5UUiRaTEh unndWzOa1mXDLyzCnvSkA9GCDGhAzkBzNyXf5t1Q= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 97E27386EC33 for ; Fri, 14 Jan 2022 16:52:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 97E27386EC33 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-Eoe0BANYP2ecbaAHELqgGQ-1; Fri, 14 Jan 2022 11:52:36 -0500 X-MC-Unique: Eoe0BANYP2ecbaAHELqgGQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8C883E743 for ; Fri, 14 Jan 2022 16:52:35 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7F3B7AD1C for ; Fri, 14 Jan 2022 16:52:34 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 2/6] elf: Split dl-printf.c from dl-misc.c In-Reply-To: References: X-From-Line: c973be97d572d05e9d44d4e8c3e8ba2ccda092b5 Mon Sep 17 00:00:00 2001 Message-Id: Date: Fri, 14 Jan 2022 17:52:32 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This allows to use different compiler flags for the diagnostics code. Reviewed-by: H.J. Lu --- v2: Adjust to Makefile changes in patch 1. elf/Makefile | 1 + elf/dl-misc.c | 281 +--------------------------------------------- elf/dl-printf.c | 292 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 297 insertions(+), 277 deletions(-) create mode 100644 elf/dl-printf.c diff --git a/elf/Makefile b/elf/Makefile index 3065efc485..3df49742ff 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -69,6 +69,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 452b79de4a..6f40c28820 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 0000000000..d3264ba96c --- /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) From patchwork Fri Jan 14 16:52:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50041 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D577A383603F for ; Fri, 14 Jan 2022 16:54:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D577A383603F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179283; bh=Ttn5BabP6c9ZvlsagDR4wJKbO2xOeyyXsAGOllT8dew=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HK0IW+3TDyzIIavcIcds3dbeeYie/e/8QO6hQMNyuwTs+qv9WQxjWAQ8yktajWFXd A+IO4/ECQ/0MCEqP1mR9vI4S2Ol9wCkCCFPGeXLx1BtMa2MsAmNvvmqsJAZHrQFuZa w1X1qcwUIj+aPghDabnTcap+ghTLcm8IWYgawMug= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5FC40385DC11 for ; Fri, 14 Jan 2022 16:53:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5FC40385DC11 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-tDIryjl1PB6GCsqn5UOimg-1; Fri, 14 Jan 2022 11:53:01 -0500 X-MC-Unique: tDIryjl1PB6GCsqn5UOimg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7E3F81CCB8 for ; Fri, 14 Jan 2022 16:53:00 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DCFDB79A2D for ; Fri, 14 Jan 2022 16:52:59 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 3/6] Add --with-rtld-early-cflags configure option In-Reply-To: References: X-From-Line: 715520a1d4e694057ead5b76e58eac4af5ee76f5 Mon Sep 17 00:00:00 2001 Message-Id: <715520a1d4e694057ead5b76e58eac4af5ee76f5.1642179009.git.fweimer@redhat.com> Date: Fri, 14 Jan 2022 17:52:57 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" --- v2: Rename configure option. Regenerate INSTALL. INSTALL | 8 ++++++++ config.make.in | 1 + configure | 13 +++++++++++++ configure.ac | 6 ++++++ elf/Makefile | 8 ++++++++ manual/install.texi | 7 +++++++ 6 files changed, 43 insertions(+) Reviewed-by: H.J. Lu diff --git a/INSTALL b/INSTALL index 331d405e56..a9dc12fa31 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). + '--with-timeoutfactor=NUM' Specify an integer NUM to scale the timeout of test programs. This factor can be changed at run time using 'TIMEOUTFACTOR' environment diff --git a/config.make.in b/config.make.in index e8630a8d0c..6d43e691f7 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 3f956cf777..6a7e5c6164 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 with_timeoutfactor enable_sanity_checks enable_shared @@ -1480,6 +1482,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-timeoutfactor=NUM specify an integer to scale the timeout --with-cpu=CPU select code for CPU variant @@ -3386,6 +3390,15 @@ 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 --with-timeoutfactor was given. if test "${with_timeoutfactor+set}" = set; then : diff --git a/configure.ac b/configure.ac index 277d3527d2..40f2de1661 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_WITH([timeoutfactor], AS_HELP_STRING([--with-timeoutfactor=NUM], diff --git a/elf/Makefile b/elf/Makefile index 3df49742ff..e6a28b243b 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -167,6 +167,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 b1afc56f5a..accaef45fa 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). + @item --with-timeoutfactor=@var{NUM} Specify an integer @var{NUM} to scale the timeout of test programs. This factor can be changed at run time using @env{TIMEOUTFACTOR} From patchwork Fri Jan 14 16:53:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50042 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F47B383603F for ; Fri, 14 Jan 2022 16:55:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F47B383603F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179326; bh=G8t//5polw7uErk86PPpTJpxraSFj9fdnjq4Plq7Zbo=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iZMHZ1QgdX5J4LlBWJqfMESqdmv2VZS4W5w5AhEBsHPVhwQlooS6n5iGCRpbVZy1O S9zps/sj7S98eQG54KpnVDUpKm3wBeTQprklhnfhrNYJaRaBF3tpA+OtZoIG8tkOyK pdB44Hs+O9XIPYgSClLgAh5G0IM1It2PlKhwROAA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 88664385DC11 for ; Fri, 14 Jan 2022 16:53:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 88664385DC11 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-199-_Ki4hvhVMv2dQmPr3-WVFA-1; Fri, 14 Jan 2022 11:53:12 -0500 X-MC-Unique: _Ki4hvhVMv2dQmPr3-WVFA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47CE783DD23 for ; Fri, 14 Jan 2022 16:53:11 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A125C7A3F5 for ; Fri, 14 Jan 2022 16:53:10 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 4/6] powerpc64le: Use in early HWCAP check In-Reply-To: References: X-From-Line: 7540e03f5d1e4f301d53f755307d12f67eb17b0b Mon Sep 17 00:00:00 2001 Message-Id: <7540e03f5d1e4f301d53f755307d12f67eb17b0b.1642179009.git.fweimer@redhat.com> Date: Fri, 14 Jan 2022 17:53:08 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 --- sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h index 713a7f0313..b43c182683 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"); From patchwork Fri Jan 14 16:53:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50043 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4BE1F3835C07 for ; Fri, 14 Jan 2022 16:56:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BE1F3835C07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179368; bh=yfYHbGOm/Qa16WtU8MbKeV+Iqm9ADfLtFSehJT8SoFk=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QYi+sRDS3vTnnURHU3NHq6QnzIteI1GkkHIkCdFj+X9/RlLa59RlmITGrEP9MMI9d mGpCepwNvwnFcUOo+2syQpQlHmhRdpUcXnU/37JHNuZSC4Qbg4QOTXTNsxF8tNw0B4 MNjI5Fa50eUAo0g8Xs8yPKmTgUg++EGQfysp6tFU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7498C3835C07 for ; Fri, 14 Jan 2022 16:53:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7498C3835C07 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-141-np6qq_qcM_aSwe9igWEb2w-1; Fri, 14 Jan 2022 11:53:38 -0500 X-MC-Unique: np6qq_qcM_aSwe9igWEb2w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E26E1853028; Fri, 14 Jan 2022 16:53:37 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B71A798DB; Fri, 14 Jan 2022 16:53:36 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 5/6] x86: Add x86-64-vN check to early startup In-Reply-To: References: X-From-Line: 703f911ba1d0d946e4978830e5d3161674bfc77c Mon Sep 17 00:00:00 2001 Message-Id: <703f911ba1d0d946e4978830e5d3161674bfc77c.1642179009.git.fweimer@redhat.com> Date: Fri, 14 Jan 2022 17:53:34 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 --- v2: Reflect renamed Makefile variable. sysdeps/x86/Makefile | 1 + sysdeps/x86/dl-get-cpu-features.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 402986ff68..6cf708335c 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 6339c9df4e..4ec0e5d2af 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, From patchwork Fri Jan 14 16:53:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 50044 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 73CCB386EC4B for ; Fri, 14 Jan 2022 16:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73CCB386EC4B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642179410; bh=iWD3rFVqrEITrmfatwBSBDBoC3hDnEje4w9Zl/NryIc=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FN2jObpcd9C3XxtGUmp6phGDn1pUMmAPBFGUAjYIxrVEz4c+aV0qChbKS8K5F/CQ7 Lao8lcxSGwPIetcZHsvjm9EA60HDJXJbZtP+jr705CzZ/DeeyVSpxBNc7hZjkt0Fxa vnaUfq/rYfu2kjo6gikNGnY/f0UPN1IHnRZzKTDo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 41DEE383600D for ; Fri, 14 Jan 2022 16:53:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 41DEE383600D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-262-v_D7myfMNLSpfX0qX7_50A-1; Fri, 14 Jan 2022 11:53:48 -0500 X-MC-Unique: v_D7myfMNLSpfX0qX7_50A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EC031006AA3 for ; Fri, 14 Jan 2022 16:53:48 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6661F7E205 for ; Fri, 14 Jan 2022 16:53:47 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 6/6] s390x: Use in early HWCAP check In-Reply-To: References: X-From-Line: 07f71c2a57d045f20aebc2217a7f7f635785e5f6 Mon Sep 17 00:00:00 2001 Message-Id: <07f71c2a57d045f20aebc2217a7f7f635785e5f6.1642179009.git.fweimer@redhat.com> Date: Fri, 14 Jan 2022 17:53:45 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 --- sysdeps/s390/s390-64/dl-hwcap-check.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h index 53e02250b8..f769932325 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");