Set the sh_entsize field of .stab to 12

Message ID 20200403045843.164144-1-maskray@google.com
State Superseded
Headers show
Series
  • Set the sh_entsize field of .stab to 12
Related show

Commit Message

Jose E. Marchesi via Binutils April 3, 2020, 4:58 a.m.
---
 bfd/ChangeLog | 4 ++++
 bfd/elf.c     | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.26.0.292.g33ef6b2f38-goog

Comments

Jose E. Marchesi via Binutils April 3, 2020, 5:15 a.m. | #1
On Thu, Apr 02, 2020 at 09:58:43PM -0700, Fangrui Song via Binutils wrote:
> ---

>  bfd/ChangeLog | 4 ++++

>  bfd/elf.c     | 4 +---

>  2 files changed, 5 insertions(+), 3 deletions(-)

> 

> diff --git a/bfd/ChangeLog b/bfd/ChangeLog

> index 64c3dde475..90e19b8612 100644

> --- a/bfd/ChangeLog

> +++ b/bfd/ChangeLog

> @@ -1,3 +1,7 @@

> +2020-04-02  Fangrui Song  <maskray@google.com>

> +

> +	* elf.c (assign_section_numbers): Set .stab sh_entsize to 12.

> +

>  2020-04-02  Jan W. Jagersma  <jwjagersma@gmail.com>


OK.  Please justify the patch when posting and in the git log.
"Only 32-bit stabs are supported" would do.

>  	* bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add

> diff --git a/bfd/elf.c b/bfd/elf.c

> index 86dadea05c..0c550bdadf 100644

> --- a/bfd/elf.c

> +++ b/bfd/elf.c

> @@ -3998,9 +3998,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)

>  		  elf_section_data (s)->this_hdr.sh_link = d->this_idx;

>  

>  		  /* This is a .stab section.  */

> -		  if (elf_section_data (s)->this_hdr.sh_entsize == 0)

> -		    elf_section_data (s)->this_hdr.sh_entsize

> -		      = 4 + 2 * bfd_get_arch_size (abfd) / 8;

> +		  elf_section_data (s)->this_hdr.sh_entsize = 12;

>  		}

>  	    }

>  	  break;

> -- 

> 2.26.0.292.g33ef6b2f38-goog


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 64c3dde475..90e19b8612 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@ 
+2020-04-02  Fangrui Song  <maskray@google.com>
+
+	* elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
+
 2020-04-02  Jan W. Jagersma  <jwjagersma@gmail.com>
 
 	* bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
diff --git a/bfd/elf.c b/bfd/elf.c
index 86dadea05c..0c550bdadf 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3998,9 +3998,7 @@  assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
 		  elf_section_data (s)->this_hdr.sh_link = d->this_idx;
 
 		  /* This is a .stab section.  */
-		  if (elf_section_data (s)->this_hdr.sh_entsize == 0)
-		    elf_section_data (s)->this_hdr.sh_entsize
-		      = 4 + 2 * bfd_get_arch_size (abfd) / 8;
+		  elf_section_data (s)->this_hdr.sh_entsize = 12;
 		}
 	    }
 	  break;