[PUSHED] readelf: Do not require EI_OSABI for IFUNC.

Message ID 9790982d-5a3d-f711-b588-184edd41a0dd@suse.cz
State Repeat Merge
Headers
Series [PUSHED] readelf: Do not require EI_OSABI for IFUNC. |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Martin Liška Nov. 24, 2022, 12:18 p.m. UTC
  Pushed as it's pre-approved by Nick.

Cheers,
Martin

	PR29718

binutils/ChangeLog:

	* readelf.c (get_symbol_type): Consider STT_GNU_IFUNC as
	reserved name.
---
 binutils/readelf.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Richard Earnshaw Nov. 24, 2022, 12:27 p.m. UTC | #1
On 24/11/2022 12:18, Martin Liška wrote:
> Pushed as it's pre-approved by Nick.
> 
> Cheers,
> Martin
> 
> 	PR29718
> 
> binutils/ChangeLog:
> 
> 	* readelf.c (get_symbol_type): Consider STT_GNU_IFUNC as
> 	reserved name.

STT_GNU_IFUNC is defined in the OS-specific reserved space.  How can it 
be globally reserved? It can't have meaning unless the OS ABI defines it 
as this.

R.


> ---
>   binutils/readelf.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/binutils/readelf.c b/binutils/readelf.c
> index 1bd6df9448a..365c1ede0a1 100644
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -12724,6 +12724,9 @@ get_symbol_type (Filedata * filedata, unsigned int type)
>       case STT_TLS:	return "TLS";
>       case STT_RELC:      return "RELC";
>       case STT_SRELC:     return "SRELC";
> +    case STT_GNU_IFUNC: return "IFUNC"; /* As mentioned in PR29718, do not
> +					   require EI_OSABI as IFUNC is
> +					   a reseved name.  */
>       default:
>         if (type >= STT_LOPROC && type <= STT_HIPROC)
>   	{
> @@ -12748,11 +12751,6 @@ get_symbol_type (Filedata * filedata, unsigned int type)
>   		return "HP_STUB";
>   	    }
>   
> -	  if (type == STT_GNU_IFUNC
> -	      && (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_GNU
> -		  || filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_FREEBSD))
> -	    return "IFUNC";
> -
>   	  snprintf (buff, sizeof (buff), _("<OS specific>: %d"), type);
>   	}
>         else
  
Martin Liška Nov. 24, 2022, 12:45 p.m. UTC | #2
On 11/24/22 13:27, Richard Earnshaw wrote:
> On 24/11/2022 12:18, Martin Liška wrote:
>> Pushed as it's pre-approved by Nick.
>>
>> Cheers,
>> Martin
>>
>>     PR29718
>>
>> binutils/ChangeLog:
>>
>>     * readelf.c (get_symbol_type): Consider STT_GNU_IFUNC as
>>     reserved name.
> 
> STT_GNU_IFUNC is defined in the OS-specific reserved space.  How can it be globally reserved? It can't have meaning unless the OS ABI defines it as this.

https://sourceware.org/bugzilla/show_bug.cgi?id=29718#c0

Please reply to this PR.

Thanks,
Martin

> 
> R.
> 
> 
>> ---
>>   binutils/readelf.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/binutils/readelf.c b/binutils/readelf.c
>> index 1bd6df9448a..365c1ede0a1 100644
>> --- a/binutils/readelf.c
>> +++ b/binutils/readelf.c
>> @@ -12724,6 +12724,9 @@ get_symbol_type (Filedata * filedata, unsigned int type)
>>       case STT_TLS:    return "TLS";
>>       case STT_RELC:      return "RELC";
>>       case STT_SRELC:     return "SRELC";
>> +    case STT_GNU_IFUNC: return "IFUNC"; /* As mentioned in PR29718, do not
>> +                       require EI_OSABI as IFUNC is
>> +                       a reseved name.  */
>>       default:
>>         if (type >= STT_LOPROC && type <= STT_HIPROC)
>>       {
>> @@ -12748,11 +12751,6 @@ get_symbol_type (Filedata * filedata, unsigned int type)
>>           return "HP_STUB";
>>           }
>>   -      if (type == STT_GNU_IFUNC
>> -          && (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_GNU
>> -          || filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_FREEBSD))
>> -        return "IFUNC";
>> -
>>         snprintf (buff, sizeof (buff), _("<OS specific>: %d"), type);
>>       }
>>         else
  

Patch

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1bd6df9448a..365c1ede0a1 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12724,6 +12724,9 @@  get_symbol_type (Filedata * filedata, unsigned int type)
     case STT_TLS:	return "TLS";
     case STT_RELC:      return "RELC";
     case STT_SRELC:     return "SRELC";
+    case STT_GNU_IFUNC: return "IFUNC"; /* As mentioned in PR29718, do not
+					   require EI_OSABI as IFUNC is
+					   a reseved name.  */
     default:
       if (type >= STT_LOPROC && type <= STT_HIPROC)
 	{
@@ -12748,11 +12751,6 @@  get_symbol_type (Filedata * filedata, unsigned int type)
 		return "HP_STUB";
 	    }
 
-	  if (type == STT_GNU_IFUNC
-	      && (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_GNU
-		  || filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_FREEBSD))
-	    return "IFUNC";
-
 	  snprintf (buff, sizeof (buff), _("<OS specific>: %d"), type);
 	}
       else