From patchwork Mon Mar 6 19:16:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 659263 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1987747wrb; Mon, 6 Mar 2023 11:17:16 -0800 (PST) X-Google-Smtp-Source: AK7set+KUtvLlO8bkQy5w/cbsDEF+plBVvopTChICyUehFjx6fqxTvGlMDosDnT4qWqHZgrSo35l X-Received: by 2002:a17:907:6da3:b0:878:50f7:a35a with SMTP id sb35-20020a1709076da300b0087850f7a35amr14811902ejc.72.1678130236089; Mon, 06 Mar 2023 11:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678130236; cv=none; d=google.com; s=arc-20160816; b=fnN2ozI0HqQwSgcADLbz+P/Kmuws9n1P05cuBMeYiq+Xk3n6IOq19Wuv8BmA2kqUY3 GABtmImWbitjX5o4MtCqdd68FI6AXNT7auEXeHKQ7F/VGxcG/wZhXpLrzUFVDfFuCh4p 1Jt6RSwnViH9/pX3XYCR37U8J0qvVqUAXshfv0Oitl/ombkaECZ09oUjNxMjzxMdPJK5 dcKwcdyl8CIk3MMgiJ7kmjeFkqNaTifhzIedQWyJN2ALoOHWJ608Xn7CRYPJpAsjEGHZ 7ySQCAiThPtRWl8vc25FEbFsxuNs/XWVE0+9INxAI8bohb28FFajS4yBu8gnM3rJKAMa b1Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=pNTk6GJblZrsnWty2ZMiY35c8st3M3q4QYXgHx2nMao=; b=JlcXwzrUaPkg4jsrfUFtZHtr3/ZgIZ9Mc4F5Gm3Av+ro/SkvFhdt4QNbGYVmcpaLgQ H0jtFIzHadR8LvIVh5NcNzznkh7S6k/0fMbinAGxddm3xjJGTU0sBeAaC/thaSC+yc18 57Y9E5aSbL7sEg+w9SLeOermFWipS1R1AAkjUZ/F/j3njXiT8Mn+DGLl5NqmwXBeM2dW 2LNEzIOMxAP2+z3ck3N84qbpPRdL6LDOHAzedY9yTyft7i81SOCm0jyFYMTkYxuay7SR 8ZIPuX/+TVUqHBn9U+TtDDdYLfzww1yihoFrBL4tRuSuXZaTSQdRkvEA1vdmrBI4WsuS KXwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="A/BmxI7D"; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Return-Path: Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x14-20020a170906b08e00b008de4a641fe0si830707ejy.938.2023.03.06.11.17.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 11:17:16 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="A/BmxI7D"; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A73C3850875 for ; Mon, 6 Mar 2023 19:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A73C3850875 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678130235; bh=pNTk6GJblZrsnWty2ZMiY35c8st3M3q4QYXgHx2nMao=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=A/BmxI7D0qwYZ5fbJssDH3MAGrOeAz/zo74XzPKb0kpo/2KAJHItXGm+zkyfJwSTp eNr+EqPisyQEPJWMq/g3YxoZgI33YAgHiABabMDtrDckhj2ARZTdDkb3dj10V06t+S uSxjL7BVkSi+dirgrcwuT9nmamBeUolcIgFxWpyQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id DA921385C301 for ; Mon, 6 Mar 2023 19:16:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA921385C301 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-17638494edbso12526849fac.10 for ; Mon, 06 Mar 2023 11:16:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678130219; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pNTk6GJblZrsnWty2ZMiY35c8st3M3q4QYXgHx2nMao=; b=BRgdBLHM0fy9fvPD/KU578Xiz9dCuUapjzDsmuxSxZPG8e8vd7LvrazoeTmg1KzXMw SFqK4AOA7+V6CRsP3Ts6WypZIS5hoSRH5BV1H2J7x6S/2B0IJjxh2q89p5VlCgI6uwpZ veI1UeRrlut5WHErjeyETctn6WtDBa4i9iUqCeuFK2MA9NhpXtIkPOHtqBFfUcAC3jnj vCsCR2sNzsO9cUoHj6zWLF0ssNo1UzpyRKxzaVegZzeU/7QrreggwW4C4j7CtddI5sQX SHoxawkUFlDgDXWrDy7M7R9FT5K/rtZIWCsAXG+6zfYbc0xq2AiSMkn7wZmnMgUu8hIx YopA== X-Gm-Message-State: AO0yUKUEhW1P/bZ9BCfzRNBO45rYqxEXlSYYnNShsT8UkKM2CJnNDKVu 84VryDxR0Fd6g69/R2uYAGxiUaAa1ytaU+NiIu998w== X-Received: by 2002:a05:6870:1116:b0:176:21a9:bf95 with SMTP id 22-20020a056870111600b0017621a9bf95mr5441619oaf.46.1678130218723; Mon, 06 Mar 2023 11:16:58 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:d849:8c2f:e58d:3e6:9de5]) by smtp.gmail.com with ESMTPSA id zf29-20020a0568716a9d00b00176598b79d3sm4280668oab.24.2023.03.06.11.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 11:16:58 -0800 (PST) To: libc-alpha@sourceware.org, Florian Weimer , Carlos O'Donell Cc: Adhemerval Zanella Netto Subject: [PATCH v5 4/5] Remove --with-default-link configure option Date: Mon, 6 Mar 2023 16:16:41 -0300 Message-Id: <20230306191642.347001-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230306191642.347001-1-adhemerval.zanella@linaro.org> References: <20230306191642.347001-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org Sender: "Libc-alpha" From: Adhemerval Zanella Netto Now that there is no need to use a special linker script to hardening internal data structures, remove the --with-default-link configure option and associated definitions. Reviewed-by: Carlos O'Donell --- INSTALL | 6 ------ Makerules | 21 ++++++--------------- config.make.in | 1 - configure | 13 ------------- configure.ac | 7 ------- elf/Makefile | 2 -- iconvdata/extra-module.mk | 2 +- manual/install.texi | 6 ------ 8 files changed, 7 insertions(+), 51 deletions(-) diff --git a/INSTALL b/INSTALL index 970d6627e2..cc1bfe9cbb 100644 --- a/INSTALL +++ b/INSTALL @@ -90,12 +90,6 @@ if 'CFLAGS' is specified it must enable optimization. For example: library will still be usable, but functionality may be lost--for example, you can't build a shared libc with old binutils. -'--with-default-link' - With '--with-default-link', the build system does not use a custom - linker script for linking shared objects. The default is - '--without-default-link', because the custom linker script is - needed for full RELRO protection. - '--with-nonshared-cflags=CFLAGS' Use additional compiler flags CFLAGS to build the parts of the library which are always statically linked into applications and diff --git a/Makerules b/Makerules index 16887cb443..31064470e5 100644 --- a/Makerules +++ b/Makerules @@ -544,13 +544,8 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \ -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) endef -# If the linker is good enough, we can let it use its default linker script. -# In the long term the custom linker script will be removed. -shlib-lds = -shlib-lds-flags = - define build-shlib -$(build-shlib-helper) -o $@ $(shlib-lds-flags) \ +$(build-shlib-helper) -o $@ \ $(csu-objpfx)abi-note.o $(build-shlib-objlist) endef @@ -569,12 +564,12 @@ endef # binutils only position loadable notes into the first page for binaries, # not for shared objects define build-module -$(build-module-helper) -o $@ $(shlib-lds-flags) \ +$(build-module-helper) -o $@ \ $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args) $(call after-link,$@) endef define build-module-asneeded -$(build-module-helper) -o $@ $(shlib-lds-flags) \ +$(build-module-helper) -o $@ \ $(csu-objpfx)abi-note.o \ -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \ $(link-libc-args) @@ -606,7 +601,6 @@ $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a $(LINK.o) -nostdlib -nostartfiles -r -o $@ \ $(LDFLAGS-c_pic.os) $(whole-archive) $^ -o $@ -ifeq (,$(strip $(shlib-lds-flags))) # Generate a list of -R options to excise .gnu.glibc-stub.* sections. $(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os $(OBJDUMP) -h $< | \ @@ -620,7 +614,6 @@ $(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \ generated += libc_pic.opts libc_pic.os.clean libc_pic_clean := .clean -endif # Build a possibly-modified version of libc_pic.a for use in building # linkobj/libc.so. @@ -650,16 +643,14 @@ $(common-objpfx)linkobj/libc.so: link-libc-deps = # empty $(common-objpfx)libc.so: $(common-objpfx)libc_pic.os$(libc_pic_clean) \ $(elf-objpfx)sofini.os \ $(elf-objpfx)interp.os \ - $(elf-objpfx)ld.so \ - $(shlib-lds) + $(elf-objpfx)ld.so $(build-shlib) $(call after-link,$@) $(common-objpfx)linkobj/libc.so: $(common-objpfx)linkobj/libc_pic.a \ $(elf-objpfx)sofini.os \ $(elf-objpfx)interp.os \ - $(elf-objpfx)ld.so \ - $(shlib-lds) + $(elf-objpfx)ld.so $(build-shlib) $(call after-link,$@) @@ -720,7 +711,7 @@ endif extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names)) $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \ - $(objpfx)%.os $(shlib-lds) $(link-libs-deps) + $(objpfx)%.os $(link-libs-deps) $(build-module) endif diff --git a/config.make.in b/config.make.in index d7c416cbea..befcc22625 100644 --- a/config.make.in +++ b/config.make.in @@ -69,7 +69,6 @@ have-libaudit = @have_libaudit@ have-libcap = @have_libcap@ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@ bind-now = @bindnow@ -use-default-link = @use_default_link@ have-cxx-thread_local = @libc_cv_cxx_thread_local@ have-loop-to-function = @libc_cv_cc_loop_to_function@ have-textrel_ifunc = @libc_cv_textrel_ifunc@ diff --git a/configure b/configure index efb891456a..c5a831e3cd 100755 --- a/configure +++ b/configure @@ -680,7 +680,6 @@ hardcoded_path_in_tests enable_timezone_tools rtld_early_cflags extra_nonshared_cflags -use_default_link sysheaders ac_ct_CXX CXXFLAGS @@ -756,7 +755,6 @@ with_gd_lib with_binutils with_selinux with_headers -with_default_link with_nonshared_cflags with_rtld_early_cflags with_timeoutfactor @@ -1475,7 +1473,6 @@ Optional Packages: --with-selinux if building with SELinux support --with-headers=PATH location of system headers to use (for example /usr/src/linux/include) [default=compiler default] - --with-default-link do not use explicit linker scripts --with-nonshared-cflags=CFLAGS build nonshared libraries with additional CFLAGS --with-rtld-early-cflags=CFLAGS @@ -3275,16 +3272,6 @@ fi - -# Check whether --with-default-link was given. -if test "${with_default_link+set}" = set; then : - withval=$with_default_link; use_default_link=$withval -else - use_default_link=no -fi - - - # Check whether --with-nonshared-cflags was given. if test "${with_nonshared_cflags+set}" = set; then : withval=$with_nonshared_cflags; extra_nonshared_cflags=$withval diff --git a/configure.ac b/configure.ac index 011844a3d4..88a6a88220 100644 --- a/configure.ac +++ b/configure.ac @@ -147,13 +147,6 @@ AC_ARG_WITH([headers], [sysheaders='']) AC_SUBST(sysheaders) -AC_SUBST(use_default_link) -AC_ARG_WITH([default-link], - AS_HELP_STRING([--with-default-link], - [do not use explicit linker scripts]), - [use_default_link=$withval], - [use_default_link=no]) - dnl Additional build flags injection. AC_ARG_WITH([nonshared-cflags], AS_HELP_STRING([--with-nonshared-cflags=CFLAGS], diff --git a/elf/Makefile b/elf/Makefile index b7f31cdf1c..dcdfd0af87 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1237,8 +1237,6 @@ endif # Command to link into a larger single relocatable object. reloc-link = $(LINK.o) -nostdlib -nostartfiles -r -$(objpfx)sotruss-lib.so: $(shlib-lds) - $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os) $(reloc-link) -o $@ $^ diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk index ecaf507624..a816659763 100644 --- a/iconvdata/extra-module.mk +++ b/iconvdata/extra-module.mk @@ -4,7 +4,7 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left))) extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines)) $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\ - $(shlib-lds) $(link-libc-deps) + $(link-libc-deps) $(build-module-asneeded) ifneq (,$(extra-modules-left)) diff --git a/manual/install.texi b/manual/install.texi index 260f8a5c82..60fca21aed 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -117,12 +117,6 @@ problem and suppress these constructs, so that the library will still be usable, but functionality may be lost---for example, you can't build a shared libc with old binutils. -@item --with-default-link -With @code{--with-default-link}, the build system does not use a custom -linker script for linking shared objects. The default is -@code{--without-default-link}, because the custom linker script is -needed for full RELRO protection. - @item --with-nonshared-cflags=@var{cflags} Use additional compiler flags @var{cflags} to build the parts of the library which are always statically linked into applications and