[PATCH] Set the sh_entsize field of .stab to 12

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
---
 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  <[hidden email]>
+
+ * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
+
 2020-04-02  Jan W. Jagersma  <[hidden email]>
 
  * 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

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
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  <[hidden email]>
> +
> + * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
> +
>  2020-04-02  Jan W. Jagersma  <[hidden email]>

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
Reply | Threaded
Open this post in threaded view
|

[PATCH v2] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
The existing code assumes sh_entsize(.stab)=20 on ELFCLASS64.
However, the assembler only supports 32-bit stabs. So set sh_entsize unconditionally to 12.

        PR gas/25768
        * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
---
 bfd/ChangeLog | 5 +++++
 bfd/elf.c     | 4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 64c3dde475..47b8e566ef 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-02  Fangrui Song  <[hidden email]>
+
+ PR gas/25768
+ * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
+
 2020-04-02  Jan W. Jagersma  <[hidden email]>
 
  * 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

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
On 2020-04-02, Fangrui Song wrote:

>The existing code assumes sh_entsize(.stab)=20 on ELFCLASS64.
>However, the assembler only supports 32-bit stabs. So set sh_entsize unconditionally to 12.
>
> PR gas/25768
> * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
>---
> bfd/ChangeLog | 5 +++++
> bfd/elf.c     | 4 +---
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
>diff --git a/bfd/ChangeLog b/bfd/ChangeLog
>index 64c3dde475..47b8e566ef 100644
>--- a/bfd/ChangeLog
>+++ b/bfd/ChangeLog
>@@ -1,3 +1,8 @@
>+2020-04-02  Fangrui Song  <[hidden email]>
>+
>+ PR gas/25768
>+ * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
>+
> 2020-04-02  Jan W. Jagersma  <[hidden email]>
>
> * 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
>
Ping :)
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
Hi Fangrui,

>>     PR gas/25768
>>     * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.

Approved - please apply.

> Ping :)

Sorry - I blame the weather - or aliens - or anything but my own laziness.

Cheers
  Nick


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
On 2020-04-09, Nick Clifton wrote:

>Hi Fangrui,
>
>>>     PR gas/25768
>>>     * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
>
>Approved - please apply.
>
>> Ping :)
>
>Sorry - I blame the weather - or aliens - or anything but my own laziness.
>
>Cheers
>  Nick

No worries! Nick, can you apply it on my behalf? I don't have a commit bit.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] Set the sh_entsize field of .stab to 12

Sourceware - binutils list mailing list
Hi Fangrui,

>>>>     PR gas/25768
>>>>     * elf.c (assign_section_numbers): Set .stab sh_entsize to 12.
>>
>> Approved - please apply.

> No worries! Nick, can you apply it on my behalf? I don't have a commit bit.

Applied.

Cheers
  Nick