From patchwork Tue Jun 12 22:19:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 27758 Received: (qmail 91090 invoked by alias); 12 Jun 2018 22:19:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 91049 invoked by uid 89); 12 Jun 2018 22:19:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=Hx-languages-length:5780, Packages, PACKAGE X-HELO: mga01.intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH 01/20] Initial empty CPU run-time library for C: libcpu-rt-c Date: Tue, 12 Jun 2018 15:19:20 -0700 Message-Id: <20180612221939.19545-2-hjl.tools@gmail.com> In-Reply-To: <20180612221939.19545-1-hjl.tools@gmail.com> References: <20180612221939.19545-1-hjl.tools@gmail.com> Add the --enable-cpu-rt configure option to enable the CPU run-time library for C, libcpu-rt-c. libcpu-rt-c contains a subset of the C library with the optimized functions. The resulting libcpu-rt-c.so should be binary compatible with older versions of libc.so so that libcpu-rt-c.so can be used with LD_PRELOAD or linked directly with applications. * Makeconfig (rpath-dirs): Add cpu-rt-c. (all-subdirs): Likewise. * configure: Regenerated. * configure.ac: Add --enable-cpu-rt. (build-cpu-rt): New LIBC_CONFIG_VAR. * shlib-versions: Add libcpu_rt-c. * cpu-rt-c/Makefile: New file. --- Makeconfig | 4 ++-- configure | 17 +++++++++++++++++ configure.ac | 11 +++++++++++ cpu-rt-c/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ shlib-versions | 3 +++ 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 cpu-rt-c/Makefile diff --git a/Makeconfig b/Makeconfig index 1afe86475c..ed894b7c8f 100644 --- a/Makeconfig +++ b/Makeconfig @@ -566,7 +566,7 @@ link-libc-printers-tests = $(link-libc-rpath) \ $(link-libc-tests-after-rpath-link) # This is how to find at build-time things that will be installed there. -rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support +rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec cpu-rt-c support rpath-link = \ $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) else # build-static @@ -1206,7 +1206,7 @@ all-subdirs = csu assert ctype locale intl catgets math setjmp signal \ grp pwd posix io termios resource misc socket sysvipc gmon \ gnulib iconv iconvdata wctype manual shadow gshadow po argp \ crypt localedata timezone rt conform debug mathvec support \ - dlfcn elf + dlfcn elf cpu-rt-c ifndef avoid-generated # sysd-sorted itself will contain rules making the sysd-sorted target diff --git a/configure b/configure index 7a8bd3f817..580bebb75d 100755 --- a/configure +++ b/configure @@ -788,6 +788,7 @@ enable_nscd enable_pt_chown enable_tunables enable_mathvec +enable_cpu_rt with_cpu ' ac_precious_vars='build_alias @@ -1461,6 +1462,8 @@ Optional Features: 'no' and 'valstring' --enable-mathvec Enable building and installing mathvec [default depends on architecture] + --enable-cpu-rt Enable building and installing CPU run-time library + [default depends on architecture] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -3741,6 +3744,14 @@ else fi +# Check whether --enable-cpu-rt was given. +if test "${enable_cpu_rt+set}" = set; then : + enableval=$enable_cpu_rt; build_cpu_rt=$enableval +else + build_cpu_rt=notset +fi + + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. @@ -6678,6 +6689,12 @@ fi config_vars="$config_vars build-mathvec = $build_mathvec" +if test x"$build_cpu_rt" = xnotset; then + build_cpu_rt=no +fi +config_vars="$config_vars +build-cpu-rt = $build_cpu_rt" + diff --git a/configure.ac b/configure.ac index ca1282a6b3..a851d958f1 100644 --- a/configure.ac +++ b/configure.ac @@ -453,6 +453,12 @@ AC_ARG_ENABLE([mathvec], [build_mathvec=$enableval], [build_mathvec=notset]) +AC_ARG_ENABLE([cpu-rt], + [AS_HELP_STRING([--enable-cpu-rt], + [Enable building and installing CPU run-time library @<:@default depends on architecture@:>@])], + [build_cpu_rt=$enableval], + [build_cpu_rt=notset]) + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. @@ -1737,6 +1743,11 @@ if test x"$build_mathvec" = xnotset; then fi LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec]) +if test x"$build_cpu_rt" = xnotset; then + build_cpu_rt=no +fi +LIBC_CONFIG_VAR([build-cpu-rt], [$build_cpu_rt]) + AC_SUBST(libc_extra_cflags) AC_SUBST(libc_extra_cppflags) diff --git a/cpu-rt-c/Makefile b/cpu-rt-c/Makefile new file mode 100644 index 0000000000..f138911347 --- /dev/null +++ b/cpu-rt-c/Makefile @@ -0,0 +1,42 @@ +# Copyright (C) 2018 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 +# . + +# Makefile for the CPU run-time library for C. + +subdir := cpu-rt-c + +include ../Makeconfig + +ifeq ($(build-cpu-rt),yes) +extra-libs := libcpu-rt-c +extra-libs-others = $(extra-libs) + +libcpu-rt-c-sysdep_routines += $(cpu-rt-c-routines) +libcpu-rt-c-tests += $(addprefix test-,$(cpu-rt-c-routines)) +tests += $(libcpu-rt-c-tests) +endif + +include ../Rules + +ifeq ($(build-cpu-rt),yes) +ifeq ($(build-shared),yes) +libcpu-rt-c = $(objpfx)libcpu-rt-c.so +else +libcpu-rt-c = $(objpfx)libcpu-rt-c.a +endif +$(addprefix $(objpfx),$(libcpu-rt-c-tests)): $(libcpu-rt-c) +endif diff --git a/shlib-versions b/shlib-versions index b9cb99d2fb..43e4c63f54 100644 --- a/shlib-versions +++ b/shlib-versions @@ -75,3 +75,6 @@ libgcc_s=1 # The vector math library libmvec=1 + +# The CPU run-time library for C +libcpu_rt_c=1