From patchwork Mon Aug 7 10:33:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Arsen_Arsenovi=C4=87?= X-Patchwork-Id: 131837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1386638vqr; Mon, 7 Aug 2023 04:43:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHejMjKprVXevxhJg0XVSqbVKrcWRynOeYWqTV1YUc2Y2ezg2nsW2sgHjMdgz24oDt3xeRy X-Received: by 2002:a17:907:2e0b:b0:99c:a65a:c4b7 with SMTP id ig11-20020a1709072e0b00b0099ca65ac4b7mr7600248ejc.43.1691408588217; Mon, 07 Aug 2023 04:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691408588; cv=none; d=google.com; s=arc-20160816; b=veYNl4vFbM98aIKlaMMmSsXkD+KfSLNbcO5VA8CC/n7jGdfzToB9wPH8VNYTfnkxym SY96xBurgTq5aKUT0jMY/oNdoAR0uazdHIRmqEFe2ZFE9Nj95XdQuqb0lpUyGOEpZUVs F8+zIIpf0Yv89EMaotgcAe474OQuWD4g3rbV+1yBnBfaC/C7sKEPJh5O1kLuH1BIcXQJ zdlC1W7yx3VkZBs5GCIZv42IDOZKgj2kJdcp5tndDSp0j9se3zcshupT7DD56UKjK9Pi FwN5dKdOYxwGwFXCRxVuzT1tHUB24NWxdjoKhvFEFyodtay2Xzr2NoRNRIHcP9hevCsz miHw== 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=y0vCFDOKVY/3q3BBtzxzYpAJfV4W82TWDNjofCbYE6g=; fh=LbmRD/h+AQd2tTjpdhlp51HLuJpwP4ZRqHvrf3Ganm8=; b=LJn3WYac1ukzVHsNSRu4ke+oXH37kFJOv/u32wBfXWjyfQaCCBeKlHXXBupk40s6os jzkDhje4BKUjc2Ist4FFhzli2TIhC/k3+bmd/UbO3BqIk6TuofSQaKMgjN0MBTi80/CR UpP3pZUl3XmneeJbd0J+kTQwUnhnUib4uX8mbouyRJARbeMcmyy9qOhnabN4M+YG+4Y2 0l7o3uFcfaouh7kqyKb+dlciuZ81V4IeUfXIke7W2Acq/X9XBnrZG/WV3l49rx4ippVS if0CM8McRTkMZI4Ydw/GMLyf6tyjwLHxTI7G1GcLjBqo3eqpCCm/0Od80r5Ijz2p7InY 4+Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=auExz4iV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i27-20020a170906251b00b0099a1f78de48si5461712ejb.638.2023.08.07.04.43.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=auExz4iV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 46FDC38F9720 for ; Mon, 7 Aug 2023 11:30:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46FDC38F9720 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691407859; bh=y0vCFDOKVY/3q3BBtzxzYpAJfV4W82TWDNjofCbYE6g=; 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=auExz4iVvmQxPfSuIBu6aufnTWpKeRO/BDuKHSpJBOe95dklpV5MgaqTMRBeOT4vY 8AnKUchICj6diNrv1SkbOdZ7+AZJmEwqXyeX+1JPw2nSq9nfE/QMXOjwY8IvfdMocR xO6QJrrND+2ZY+9/wx9JEHxEe8O0fgH307chHso4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id 04834385702B for ; Mon, 7 Aug 2023 11:19:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04834385702B Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4RKDP131T0z9sck; Mon, 7 Aug 2023 13:19:33 +0200 (CEST) To: gcc-patches@gcc.gnu.org Cc: Indu Bhagat Subject: [PATCH 23/24] bfd: linker: merge .sframe sections Date: Mon, 7 Aug 2023 12:33:05 +0200 Message-ID: <20230807105935.2098236-24-arsen@aarsen.me> In-Reply-To: <20230807105935.2098236-1-arsen@aarsen.me> References: <20230807105935.2098236-1-arsen@aarsen.me> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4RKDP131T0z9sck X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Arsen_Arsenovi=C4=87_via_Gcc-patches?= From: =?utf-8?q?Arsen_Arsenovi=C4=87?= Reply-To: =?utf-8?q?Arsen_Arsenovi=C4=87?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773570451454561707 X-GMAIL-MSGID: 1773570451454561707 From: Indu Bhagat The linker merges all the input .sframe sections. When merging, the linker verifies that all the input .sframe sections have the same abi/arch. The linker uses libsframe library to perform key actions on the .sframe sections - decode, read, and create output data. This implies buildsystem changes to make and install libsframe before libbfd. The linker places the output .sframe section in a new segment of its own: PT_GNU_SFRAME. A new segment is not added, however, if the generated .sframe section is empty. When a section is discarded from the final link, the corresponding entries in the .sframe section for those functions are also deleted. The linker sorts the SFrame FDEs on start address by default and sets the SFRAME_F_FDE_SORTED flag in the .sframe section. This patch also adds support for generation of SFrame unwind information for the .plt* sections on x86_64. SFrame unwind info is generated for IBT enabled PLT, lazy/non-lazy PLT. The existing linker option --no-ld-generated-unwind-info has been adapted to include the control of whether .sframe unwind information will be generated for the linker generated sections like PLT. Changes to the linker script have been made as necessary. ChangeLog: * Makefile.def: Add install dependency on libsframe for libbfd. * Makefile.in: Regenerated. --- Makefile.def | 4 ++++ Makefile.in | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Makefile.def b/Makefile.def index 86d25f43762..0c6784b6da1 100644 --- a/Makefile.def +++ b/Makefile.def @@ -459,11 +459,14 @@ dependencies = { module=all-gdbsupport; on=all-gnulib; }; dependencies = { module=all-gdbsupport; on=all-intl; }; // Host modules specific to binutils. +// build libsframe before bfd for encoder/decoder support for linking +// SFrame sections dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; }; dependencies = { module=configure-bfd; on=configure-intl; }; dependencies = { module=all-bfd; on=all-libiberty; }; dependencies = { module=all-bfd; on=all-intl; }; dependencies = { module=all-bfd; on=all-zlib; }; +dependencies = { module=all-bfd; on=all-libsframe; }; dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; }; dependencies = { module=all-opcodes; on=all-libiberty; }; @@ -489,6 +492,7 @@ dependencies = { module=install-binutils; on=install-opcodes; }; dependencies = { module=install-strip-binutils; on=install-strip-opcodes; }; // Likewise for ld, libctf, and bfd. +dependencies = { module=install-bfd; on=install-libsframe; }; dependencies = { module=install-libctf; on=install-bfd; }; dependencies = { module=install-ld; on=install-bfd; }; dependencies = { module=install-ld; on=install-libctf; }; diff --git a/Makefile.in b/Makefile.in index 214a2a15544..35a5d8c575d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -66354,6 +66354,16 @@ all-stagetrain-bfd: maybe-all-stagetrain-zlib all-stagefeedback-bfd: maybe-all-stagefeedback-zlib all-stageautoprofile-bfd: maybe-all-stageautoprofile-zlib all-stageautofeedback-bfd: maybe-all-stageautofeedback-zlib +all-bfd: maybe-all-libsframe +all-stage1-bfd: maybe-all-stage1-libsframe +all-stage2-bfd: maybe-all-stage2-libsframe +all-stage3-bfd: maybe-all-stage3-libsframe +all-stage4-bfd: maybe-all-stage4-libsframe +all-stageprofile-bfd: maybe-all-stageprofile-libsframe +all-stagetrain-bfd: maybe-all-stagetrain-libsframe +all-stagefeedback-bfd: maybe-all-stagefeedback-libsframe +all-stageautoprofile-bfd: maybe-all-stageautoprofile-libsframe +all-stageautofeedback-bfd: maybe-all-stageautofeedback-libsframe configure-opcodes: configure-libiberty configure-stage1-opcodes: configure-stage1-libiberty configure-stage2-opcodes: configure-stage2-libiberty @@ -66486,6 +66496,7 @@ all-stageautoprofile-binutils: maybe-all-stageautoprofile-libsframe all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe install-binutils: maybe-install-opcodes install-strip-binutils: maybe-install-strip-opcodes +install-bfd: maybe-install-libsframe install-libctf: maybe-install-bfd install-ld: maybe-install-bfd install-ld: maybe-install-libctf