From patchwork Wed Oct 25 10:29:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 158052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2540473vqx; Wed, 25 Oct 2023 04:52:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrUYIHc+ueFBsoRzovEXcapo1wdPdoZJ7bwZ2RfElCsfm70wgDzDUOtvZTOJisfW/SvdGS X-Received: by 2002:a05:620a:458d:b0:779:df06:f0ec with SMTP id bp13-20020a05620a458d00b00779df06f0ecmr7788592qkb.24.1698234750911; Wed, 25 Oct 2023 04:52:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698234750; cv=pass; d=google.com; s=arc-20160816; b=FAV/FO68YYCdP7lh+aexa5DInxOXm7plxaK9oP9WDnxRc3UKtPl4bh7/vJrfhACcD2 /l8FmRBbHsd/qJX1Q54xOkDmw5cKwpIt17zdT8mKkYkd0Meew7g1wp1ViYTk9f1ZgLjp +WRzcUb7TaC4/7h5rBH0/kVO2g73X/7sgOLWNGENPLX//96+eTbbWmIoIZL5oA1Lr1k+ 50RrVy8+xcuBCtGQz++BQWPx4QWHfT7ZSSNQAAU+fYh3GE4xLHBj4ltS3siYAR3oqvUP e71qYKU5OTy8ojR3qTJsSFw1Nh5ifJTPbC45J01YMM+OrwIiHPi7HH9gUT1J7keSvOEp CgGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=c6oatP1hIq4tyw3sM3LdYQhoQTHmm8Lf5UJEy6QgIzc=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=WaAMQj0P+8q7YT/PtcD8ALWphBN1a961SADTZOA7ni24oltJd67MhW2MtdF8CyhDSR IrAlAAVMkzhrCnVMUlaAYEdDMBIfSApnx/1xTgp7OYFCe29I2t/u4CZVgVbk+bu8nyZQ UEHC8y+0XwUgRHVpmdTjEJU86Ql8sZiVVBetiWg5I41xQNORljHct+vBbAqOx4BJHvu4 lS2bvcah3GUbSUlR6RMOv1FoEQOF5/hs01x/n4BA9XENP0WBQ1GoN8H4FTlAQi3MbUFQ 1ZsALEng0GRFh2y6bhjuny8KbBUFqWLpWDhIlDALILsMXcBzMOBxiEUlmLauaHPRUAIj uatA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2nXPw2b; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l9-20020a05620a28c900b0077890c003a5si8692377qkp.293.2023.10.25.04.52.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 04:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2nXPw2b; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B50FE385624F for ; Wed, 25 Oct 2023 10:32:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.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 6CAB63858D33 for ; Wed, 25 Oct 2023 10:32:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CAB63858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6CAB63858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698229935; cv=none; b=ifl18exKHWPefnkm5ZUuFCc418e/0lhqYdcbWO2jFeTrXnRLJ8+XNqv21iUAQVTFXwgkmBpY+QF5Fs5Rdo49VbOdNlklCKTp1YvWMilCh1zFR6l9Q6faDvOkL7/bZ9R2A0n314e3TPR80b9PAGqU/rFlTyIxRAVKdRihr7ccYnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698229935; c=relaxed/simple; bh=pMvsRf7HAA59wv2QE6nQTCdqPDxNszT1DC1UI6xaI5s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rXASH+wuRfSGc2WrPDRVt0qmVNx/k7FBCKEVqE1eK8K01ZmFYKYXuQt3oxApjuJ1zbWLUrxEbXkJvzyFvWCiz9T6gGDKoXXlRNzg5NBD/8uTY7YtN/V5ZAnmrMpUiR82uCHAAXMvkdQpYjhXs/GRPreqhSN7ZY0y8xrxvEMOuD0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698229930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c6oatP1hIq4tyw3sM3LdYQhoQTHmm8Lf5UJEy6QgIzc=; b=c2nXPw2bZjbY6lCS9pkwpXGwi2NJK1mpmmZAG0ipvOZvaEOak4zEiTncP3NcuyIE1DPgp9 IdiX+N4mvY5AwuMfFcBCbTTjGEOXB6bcSAe1+9S63nc3dJEx/wGAGZjaktT3XoOzjU8Cnk WWKBBqyzoZuNIZurixrxr1g2QiNUgcQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-491-Seh6moSYOjCJKAag6DRdmw-1; Wed, 25 Oct 2023 06:32:09 -0400 X-MC-Unique: Seh6moSYOjCJKAag6DRdmw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0877891F27; Wed, 25 Oct 2023 10:32:08 +0000 (UTC) Received: from localhost (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC39625C0; Wed, 25 Oct 2023 10:32:08 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936] Date: Wed, 25 Oct 2023 11:29:52 +0100 Message-ID: <20231025103208.382438-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780728202214240279 X-GMAIL-MSGID: 1780728202214240279 Tested x86_64-linux. Pushed to trunk, will backport to 12 and 13. -- >8 -- In order for std::stacktrace to be used in a shared library, the libbacktrace symbols need to be built with -fPIC. Add the libtool -prefer-pic flag to the commands in src/libbacktrace/Makefile so that the archive contains PIC objects. libstdc++-v3/ChangeLog: PR libstdc++/111936 * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool compile commands. * src/libbacktrace/Makefile.in: Regenerate. --- libstdc++-v3/src/libbacktrace/Makefile.am | 8 ++++++-- libstdc++-v3/src/libbacktrace/Makefile.in | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am b/libstdc++-v3/src/libbacktrace/Makefile.am index 492d3b6e952..e3cede97463 100644 --- a/libstdc++-v3/src/libbacktrace/Makefile.am +++ b/libstdc++-v3/src/libbacktrace/Makefile.am @@ -49,9 +49,13 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \ -Wcast-qual C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter -AM_CFLAGS = $(C_WARN_FLAGS) +AM_CFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(C_WARN_FLAGS) AM_CFLAGS += $(EXTRA_CFLAGS) -AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions +AM_CXXFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions AM_CXXFLAGS += $(EXTRA_CXXFLAGS) obj_prefix = std_stacktrace diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in b/libstdc++-v3/src/libbacktrace/Makefile.in index a85c6d118ea..ce80d246766 100644 --- a/libstdc++-v3/src/libbacktrace/Makefile.in +++ b/libstdc++-v3/src/libbacktrace/Makefile.in @@ -472,9 +472,10 @@ libstdc___libbacktrace_la_CPPFLAGS = \ C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter -AM_CFLAGS = $(C_WARN_FLAGS) $(EXTRA_CFLAGS) -AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions \ - $(EXTRA_CXXFLAGS) +AM_CFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(C_WARN_FLAGS) $(EXTRA_CFLAGS) +AM_CXXFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions $(EXTRA_CXXFLAGS) obj_prefix = std_stacktrace # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o