public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: binutils@sourceware.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Subject: [PATCH 07/12] bfd: linker: add support for rep_block_size for pltN entries
Date: Tue, 27 Jun 2023 14:20:23 -0700	[thread overview]
Message-ID: <20230627212028.2138604-8-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20230627212028.2138604-1-indu.bhagat@oracle.com>

Use the new SFrame V2 APIs to encode the size of the pltN entries in the
SFrame FDE.

bfd/
	* elf-sframe.c (_bfd_elf_merge_section_sframe): Use new API.
	* elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Likewise.
---
 bfd/elf-sframe.c | 16 +++++++++-------
 bfd/elfxx-x86.c  | 22 ++++++++++++----------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c
index 013a892e08a..c09822a5503 100644
--- a/bfd/elf-sframe.c
+++ b/bfd/elf-sframe.c
@@ -411,16 +411,18 @@ _bfd_elf_merge_section_sframe (bfd *abfd,
   for (i = 0; i < num_fidx; i++)
     {
       unsigned int num_fres = 0;
-      int32_t func_start_address;
+      int32_t func_start_addr;
       bfd_vma address;
       uint32_t func_size = 0;
       unsigned char func_info = 0;
       unsigned int r_offset = 0;
       bool pltn_reloc_by_hand = false;
       unsigned int pltn_r_offset = 0;
+      uint8_t rep_block_size = 0;
 
-      if (!sframe_decoder_get_funcdesc (sfd_ctx, i, &num_fres, &func_size,
-					&func_start_address, &func_info))
+      if (!sframe_decoder_get_funcdesc_v2 (sfd_ctx, i, &num_fres, &func_size,
+					   &func_start_addr, &func_info,
+					   &rep_block_size))
 	{
 	  /* If function belongs to a deleted section, skip editing the
 	     function descriptor entry.  */
@@ -471,13 +473,13 @@ _bfd_elf_merge_section_sframe (bfd *abfd,
 	      /* FIXME For testing only. Cleanup later.  */
 	      // address += (sec->output_section->vma);
 
-	      func_start_address = address;
+	      func_start_addr = address;
 	    }
 
 	  /* Update the encoder context with updated content.  */
-	  int err = sframe_encoder_add_funcdesc (sfe_ctx, func_start_address,
-						 func_size, func_info,
-						 num_fres);
+	  int err = sframe_encoder_add_funcdesc_v2 (sfe_ctx, func_start_addr,
+						    func_size, func_info,
+						    rep_block_size, num_fres);
 	  cur_fidx++;
 	  BFD_ASSERT (!err);
 	}
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index ffd02f137d1..b6512c9c49c 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -1900,11 +1900,12 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
     {
       /* Add SFrame FDE for plt0, the function start address is updated later
 	 at _bfd_elf_merge_section_sframe time.  */
-      sframe_encoder_add_funcdesc (*ectx,
-				   0, /* func start addr.  */
-				   plt0_entry_size,
-				   func_info,
-				   0 /* Num FREs.  */);
+      sframe_encoder_add_funcdesc_v2 (*ectx,
+				      0, /* func start addr.  */
+				      plt0_entry_size,
+				      func_info,
+				      16,
+				      0 /* Num FREs.  */);
       sframe_frame_row_entry plt0_fre;
       unsigned int num_plt0_fres = htab->sframe_plt->plt0_num_fres;
       for (unsigned int j = 0; j < num_plt0_fres; j++)
@@ -1928,11 +1929,12 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
 	 function start address = plt0_entry_size.  As usual, this will be
 	 updated later at _bfd_elf_merge_section_sframe, by when the
 	 sections are relocated.  */
-      sframe_encoder_add_funcdesc (*ectx,
-				   plt0_entry_size, /* func start addr.  */
-				   dpltsec->size - plt0_entry_size,
-				   func_info,
-				   0 /* Num FREs.  */);
+      sframe_encoder_add_funcdesc_v2 (*ectx,
+				      plt0_entry_size, /* func start addr.  */
+				      dpltsec->size - plt0_entry_size,
+				      func_info,
+				      16,
+				      0 /* Num FREs.  */);
 
       sframe_frame_row_entry pltn_fre;
       /* Now add the FREs for pltn.  Simply adding the two FREs suffices due
-- 
2.39.2


  parent reply	other threads:[~2023-06-27 21:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 21:20 [PATCH 00/12] SFrame Version 2 - definition and support Indu Bhagat
2023-06-27 21:20 ` [PATCH 01/12] sframe.h: format bump to SFrame version 2 Indu Bhagat
2023-06-27 21:20 ` [PATCH 02/12] gas: generate SFrame section with version SFRAME_VERSION_2 Indu Bhagat
2023-06-27 21:20 ` [PATCH 03/12] libsframe: add new APIs to get SFrame version Indu Bhagat
2023-06-27 21:20 ` [PATCH 04/12] libsframe: add new APIs to add and get SFrame FDE in SFrame version 2 Indu Bhagat
2023-06-27 21:20 ` [PATCH 05/12] libsframe: adjust version check in sframe_header_sanity_check_p Indu Bhagat
2023-06-27 21:20 ` [PATCH 06/12] libsframe: testsuite: fixes for SFRAME_VERSION_2 Indu Bhagat
2023-06-27 21:20 ` Indu Bhagat [this message]
2023-06-27 21:20 ` [PATCH 08/12] bfd: linker: generate SFrame sections with version SFRAME_VERSION_2 Indu Bhagat
2023-06-27 21:20 ` [PATCH 09/12] objdump/readelf: adjust for SFRAME_VERSION_2 Indu Bhagat
2023-06-28 23:04   ` Hans-Peter Nilsson
2023-06-29  6:41     ` Indu Bhagat
2023-06-27 21:20 ` [PATCH 10/12] doc: sframe: update specification " Indu Bhagat
2023-06-27 21:20 ` [PATCH 11/12] doc: sframe: add details about alignment in the SFrame format Indu Bhagat
2023-06-27 21:20 ` [PATCH 12/12] binutils/NEWS: announce SFrame version 2 as the new default Indu Bhagat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627212028.2138604-8-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).