[PATCH-RFC,1/1] readelf: Don't warn on non-zero sh_info for PROGBITS

Message ID 20a16539afd948ee06d09d854e861eb844342f89.1530873677.git.francois.theron@netronome.com
State New
Headers show
Series
  • readelf: Don't warn on non-zero sh_info for PROGBITS
Related show

Commit Message

Francois H. Theron July 6, 2018, 10:47 a.m.
Signed-off-by: Francois H. Theron <francois.theron@netronome.com>

---
 binutils/ChangeLog | 3 +++
 binutils/readelf.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.17.0

Comments

Alan Modra July 11, 2018, 9:42 a.m. | #1
On Fri, Jul 06, 2018 at 12:47:29PM +0200, Francois H. Theron wrote:
> diff --git a/binutils/readelf.c b/binutils/readelf.c

> index 1b50ba7631..30572584a6 100644

> --- a/binutils/readelf.c

> +++ b/binutils/readelf.c

> @@ -6366,7 +6366,8 @@ process_section_headers (Filedata * filedata)

>  

>  	default:

>  	  /* FIXME: Add support for target specific section types.  */

> -	  if (section->sh_type == SHT_NOBITS)

> +	  if (section->sh_type == SHT_NOBITS ||

> +	      section->sh_type == SHT_PROGBITS)

>  	    /* NOBITS section headers with non-zero sh_info fields can be

>  	       created when a binary is stripped of everything but its debug

>  	       information.  The stripped sections have their headers


I think you should do as the comment says, and implement target
specific support.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8b37aaeaac..6546321d4a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,6 @@ 
+2018-07-06  Francois H. Theron  <francois.theron@netronome.com>
+	* readelf.c: Accept non-zero sh_info for PROGBITS sections. 
+
 2018-07-05  Nick Clifton  <nickc@redhat.com>
 
 	* po/bg.po: Updated Bulgarian translation.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1b50ba7631..30572584a6 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6366,7 +6366,8 @@  process_section_headers (Filedata * filedata)
 
 	default:
 	  /* FIXME: Add support for target specific section types.  */
-	  if (section->sh_type == SHT_NOBITS)
+	  if (section->sh_type == SHT_NOBITS ||
+	      section->sh_type == SHT_PROGBITS)
 	    /* NOBITS section headers with non-zero sh_info fields can be
 	       created when a binary is stripped of everything but its debug
 	       information.  The stripped sections have their headers