[v2] elf: Synchronize <elf.h> section header flags with binutils

Message ID 87eek710yz.fsf@oldenburg2.str.redhat.com
State Committed
Headers
Series [v2] elf: Synchronize <elf.h> section header flags with binutils |

Commit Message

Florian Weimer Dec. 3, 2020, 1:19 p.m. UTC
  binutils 2.36 will add SHF_GNU_RETAIN support.  SHF_GNU_BUILD_NOTE
was also missing from the glibc header.

---
v2: Fix typo 29 typo.

 elf/elf.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

H.J. Lu Dec. 3, 2020, 1:24 p.m. UTC | #1
On Thu, Dec 3, 2020 at 5:19 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> binutils 2.36 will add SHF_GNU_RETAIN support.  SHF_GNU_BUILD_NOTE
> was also missing from the glibc header.
>
> ---
> v2: Fix typo 29 typo.
>
>  elf/elf.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/elf/elf.h b/elf/elf.h
> index 0ed6753a93..bd7af7cca4 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -478,6 +478,8 @@ typedef struct
>  #define SHF_COMPRESSED      (1 << 11)  /* Section with compressed data. */
>  #define SHF_MASKOS          0x0ff00000 /* OS-specific.  */
>  #define SHF_MASKPROC        0xf0000000 /* Processor-specific */
> +#define SHF_GNU_BUILD_NOTE   (1 << 20)  /* Contains GNU build notes.  */
> +#define SHF_GNU_RETAIN      (1 << 21)  /* Not to be GCed by linker.  */
>  #define SHF_ORDERED         (1 << 30)  /* Special ordering requirement
>                                            (Solaris).  */
>  #define SHF_EXCLUDE         (1U << 31) /* Section is excluded unless
>

LGTM.

Thanks.
  
Mark Wielaard Dec. 3, 2020, 1:38 p.m. UTC | #2
Hi Florian,

On Thu, 2020-12-03 at 14:19 +0100, Florian Weimer wrote:
> binutils 2.36 will add SHF_GNU_RETAIN support.  SHF_GNU_BUILD_NOTE
> was also missing from the glibc header.

What is SHF_GNU_BUILD_NOTE? What sets it, when is it set and how should
the presence or absence of the flag be interpreted?

Thanks,

Mark
  
Florian Weimer Dec. 3, 2020, 1:45 p.m. UTC | #3
* Mark Wielaard:

> Hi Florian,
>
> On Thu, 2020-12-03 at 14:19 +0100, Florian Weimer wrote:
>> binutils 2.36 will add SHF_GNU_RETAIN support.  SHF_GNU_BUILD_NOTE
>> was also missing from the glibc header.
>
> What is SHF_GNU_BUILD_NOTE? What sets it, when is it set and how should
> the presence or absence of the flag be interpreted?

It was added in:

commit 9ef920e933bf2ea228c909cf81636e6d9577e51e
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Mar 1 11:09:46 2017 +0000

    Add support for displaying and merging GNU_BUILD_NOTEs.

I agree that it would be nice to add it to the GNU gABI documentation.

In any case, the flag is now taken and should be mentioned in <elf.h>.

Thanks,
Florian
  
Mark Wielaard Dec. 3, 2020, 1:59 p.m. UTC | #4
On Thu, 2020-12-03 at 14:45 +0100, Florian Weimer wrote:
> * Mark Wielaard:
> > On Thu, 2020-12-03 at 14:19 +0100, Florian Weimer wrote:
> > > binutils 2.36 will add SHF_GNU_RETAIN support.  SHF_GNU_BUILD_NOTE
> > > was also missing from the glibc header.
> > 
> > What is SHF_GNU_BUILD_NOTE? What sets it, when is it set and how should
> > the presence or absence of the flag be interpreted?
> 
> It was added in:
> 
> commit 9ef920e933bf2ea228c909cf81636e6d9577e51e
> Author: Nick Clifton <nickc@redhat.com>
> Date:   Wed Mar 1 11:09:46 2017 +0000
> 
>     Add support for displaying and merging GNU_BUILD_NOTEs.
> 
> I agree that it would be nice to add it to the GNU gABI documentation.
> 
> In any case, the flag is now taken and should be mentioned in <elf.h>.

But is it really taken or was that just an experiment? A followup
commit (05ed43104e) seems to imply the flag is never actually emitted.

If it is actually taken and used having the precise semantics
documented seems to be essential.

Nick, do you know what is going on here? Both patches are yours.

Cheers,

Mark
  
Nick Clifton Dec. 7, 2020, 2 p.m. UTC | #5
Hi Guys,

> But is it really taken or was that just an experiment? A followup
> commit (05ed43104e) seems to imply the flag is never actually emitted.
> 
> If it is actually taken and used having the precise semantics
> documented seems to be essential.
> 
> Nick, do you know what is going on here? Both patches are yours.

It was an experiment.  And it is no longer needed, although I would
not mind if it stayed around.  But if it makes things simpler then
please do remove it from it from elf.h.

Cheers
   Nick
  
Florian Weimer Dec. 7, 2020, 2:03 p.m. UTC | #6
* Nick Clifton:

> Hi Guys,
>
>> But is it really taken or was that just an experiment? A followup
>> commit (05ed43104e) seems to imply the flag is never actually emitted.
>> If it is actually taken and used having the precise semantics
>> documented seems to be essential.
>> Nick, do you know what is going on here? Both patches are yours.
>
> It was an experiment.  And it is no longer needed, although I would
> not mind if it stayed around.  But if it makes things simpler then
> please do remove it from it from elf.h.

Okay.  Nick, can you remove it from binutils first?

Thanks,
Florian
  
Nick Clifton Dec. 7, 2020, 4:19 p.m. UTC | #7
Hi Florian,

> Okay.  Nick, can you remove it from binutils first?

Done.

Cheers
   Nick
  
Mark Wielaard Dec. 11, 2020, 11:07 p.m. UTC | #8
Hi,

On Mon, Dec 07, 2020 at 04:19:50PM +0000, Nick Clifton wrote:
> > Okay.  Nick, can you remove it from binutils first?
> 
> Done.

Thanks, here is a patch to also remove it from glibc elf.h.
OK to push?

Cheers,

Mark
  
Florian Weimer Dec. 12, 2020, 9:16 a.m. UTC | #9
* Mark Wielaard:

> On Mon, Dec 07, 2020 at 04:19:50PM +0000, Nick Clifton wrote:
>> > Okay.  Nick, can you remove it from binutils first?
>> 
>> Done.
>
> Thanks, here is a patch to also remove it from glibc elf.h.
> OK to push?

Yes, please.
  

Patch

diff --git a/elf/elf.h b/elf/elf.h
index 0ed6753a93..bd7af7cca4 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -478,6 +478,8 @@  typedef struct
 #define SHF_COMPRESSED	     (1 << 11)	/* Section with compressed data. */
 #define SHF_MASKOS	     0x0ff00000	/* OS-specific.  */
 #define SHF_MASKPROC	     0xf0000000	/* Processor-specific */
+#define SHF_GNU_BUILD_NOTE   (1 << 20)  /* Contains GNU build notes.  */
+#define SHF_GNU_RETAIN	     (1 << 21)  /* Not to be GCed by linker.  */
 #define SHF_ORDERED	     (1 << 30)	/* Special ordering requirement
 					   (Solaris).  */
 #define SHF_EXCLUDE	     (1U << 31)	/* Section is excluded unless