PATCH bfd: Fix linker warning for recently introduced arm attributes

Message ID gkr35pqkron.fsf@arm.com
State New
Headers show
Series
  • PATCH bfd: Fix linker warning for recently introduced arm attributes
Related show

Commit Message

Alan Modra via Binutils Sept. 27, 2021, 2:40 p.m.
Hi all,

this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so
that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld
does not emit the "unknown EABI object attribute" warning.

Regtested clean, okay for trunk?

Best Regards

  Andrea
From 39c0c12b13fdeb07695def0af19e8ed760bd882b Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.corallo@arm.com>

Date: Mon, 27 Sep 2021 16:04:31 +0200
Subject: [PATCH] PATCH bfd: Fix linker warning for recently introduced arm
 attributes

2021-09-27  Andrea Corallo  <andrea.corallo@arm.com>

	* elf-bfd.h (NUM_KNOWN_OBJ_ATTRIBUTES): Update value to cover
	'Tag_BTI_use' and 'Tag_PACRET_use'.
---
 bfd/elf-bfd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

Alan Modra via Binutils Sept. 30, 2021, 4:27 p.m. | #1
Hi Andrea,

> this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

> that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

> does not emit the "unknown EABI object attribute" warning.

> 

> Regtested clean, okay for trunk?


Approved - please apply.

Cheers
   Nick
Alan Modra via Binutils Oct. 1, 2021, 8:17 a.m. | #2
Nick Clifton <nickc@redhat.com> writes:

> Hi Andrea,

>

>> this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

>> that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

>> does not emit the "unknown EABI object attribute" warning.

>> Regtested clean, okay for trunk?

>

> Approved - please apply.

>

> Cheers

>   Nick


Hi Nick,

thanks for reviewing, in as 242fe37867c.

Regards

  Andrea
Alan Modra via Binutils Oct. 5, 2021, 2:49 a.m. | #3
On 2021-09-27 10:40, Andrea Corallo wrote:> Hi all,
> 

> this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

> that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

> does not emit the "unknown EABI object attribute" warning.

> 

> Regtested clean, okay for trunk?

> 

> Best Regards

> 

>   Andrea

> 

Hi Andrea,

I get some GDB failures starting with this commit.  To run:

gdb/ $ make check TESTS="gdb.cp/ambiguous.exp"

And in gdb.log:

    49 (gdb) file /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.cp/ambiguous/ambiguous^M
    50 BFD: BFD (GNU Binutils) 2.37.50.20210924 assertion fail /home/simark/src/binutils-gdb/bfd/elf.c:240^M
    51 BFD: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.cp/ambiguous/ambiguous: warning: multiple dynamic symbol tables detected - ignoring the table in section 6^M
    52 ^M
    53 ^M
    54 Fatal signal: Segmentation fault^M

Just loading the file in GDB is enough to reproduce:

  $ ./gdb -nx -q --data-directory=data-directory testsuite/outputs/gdb.cp/ambiguous/ambiguous

crashes here:

    #16 0x55695f64f856 in handle_sigsegv /home/simark/src/binutils-gdb/gdb/event-top.c:971
    #17 0x7fd2187fe86f  (/usr/lib/libpthread.so.0+0x1386f)
    #18 0x556960b22a45 in bfd_section_from_shdr /home/simark/src/binutils-gdb/bfd/elf.c:2308
    #19 0x556960b07f92 in bfd_elf64_object_p /home/simark/src/binutils-gdb/bfd/elfcode.h:834
    #20 0x556960aa5eec in bfd_check_format_matches /home/simark/src/binutils-gdb/bfd/format.c:343
    #21 0x55695f65703b in exec_file_attach(char const*, int) /home/simark/src/binutils-gdb/gdb/exec.c:471
    #22 0x55695fa8aa48 in catch_command_errors /home/simark/src/binutils-gdb/gdb/main.c:523
    #23 0x55695fa8db42 in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:1233
    #24 0x55695fa8edbe in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1343
    #25 0x55695fa8ee53 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1368
    #26 0x55695ecd5ad8 in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
    #27 0x7fd217f11b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #28 0x55695ecd58ad in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x12ec8ad)

Simon
Alan Modra via Binutils Oct. 6, 2021, 12:03 a.m. | #4
On Mon, Oct 04, 2021 at 10:49:58PM -0400, Simon Marchi via Binutils wrote:
> On 2021-09-27 10:40, Andrea Corallo wrote:> Hi all,

> > 

> > this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

> > that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

> > does not emit the "unknown EABI object attribute" warning.

> > 

> > Regtested clean, okay for trunk?

> > 

> > Best Regards

> > 

> >   Andrea

> > 

> Hi Andrea,

> 

> I get some GDB failures starting with this commit.  To run:

> 

> gdb/ $ make check TESTS="gdb.cp/ambiguous.exp"

> 

> And in gdb.log:

> 

>     49 (gdb) file /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.cp/ambiguous/ambiguous^M

>     50 BFD: BFD (GNU Binutils) 2.37.50.20210924 assertion fail /home/simark/src/binutils-gdb/bfd/elf.c:240^M


Dependency problem?  I can't see that assert being hit unless you have
stale bfd object files.

-- 
Alan Modra
Australia Development Lab, IBM
Alan Modra via Binutils Oct. 6, 2021, 2:14 a.m. | #5
On 2021-10-05 20:03, Alan Modra wrote:
> On Mon, Oct 04, 2021 at 10:49:58PM -0400, Simon Marchi via Binutils wrote:

>> On 2021-09-27 10:40, Andrea Corallo wrote:> Hi all,

>>>

>>> this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

>>> that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

>>> does not emit the "unknown EABI object attribute" warning.

>>>

>>> Regtested clean, okay for trunk?

>>>

>>> Best Regards

>>>

>>>   Andrea

>>>

>> Hi Andrea,

>>

>> I get some GDB failures starting with this commit.  To run:

>>

>> gdb/ $ make check TESTS="gdb.cp/ambiguous.exp"

>>

>> And in gdb.log:

>>

>>     49 (gdb) file /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.cp/ambiguous/ambiguous^M

>>     50 BFD: BFD (GNU Binutils) 2.37.50.20210924 assertion fail /home/simark/src/binutils-gdb/bfd/elf.c:240^M

> 

> Dependency problem?  I can't see that assert being hit unless you have

> stale bfd object files.


I tried rebuilding from scratch a few times and kept seeing it.  I
flushed my ccache cache and now I don't see it, so perhaps it was a
ccache issue (if so, that's quite rare).

So, sorry for the noise.

Simon
Alan Modra via Binutils Oct. 6, 2021, 8:24 a.m. | #6
Simon Marchi <simon.marchi@polymtl.ca> writes:

> On 2021-10-05 20:03, Alan Modra wrote:

>> On Mon, Oct 04, 2021 at 10:49:58PM -0400, Simon Marchi via Binutils wrote:

>>> On 2021-09-27 10:40, Andrea Corallo wrote:> Hi all,

>>>>

>>>> this simple patch updates the value of 'NUM_KNOWN_OBJ_ATTRIBUTES' so

>>>> that when linking objects with 'Tag_BTI_use' or 'Tag_PACRET_use' set ld

>>>> does not emit the "unknown EABI object attribute" warning.

>>>>

>>>> Regtested clean, okay for trunk?

>>>>

>>>> Best Regards

>>>>

>>>>   Andrea

>>>>

>>> Hi Andrea,

>>>

>>> I get some GDB failures starting with this commit.  To run:

>>>

>>> gdb/ $ make check TESTS="gdb.cp/ambiguous.exp"

>>>

>>> And in gdb.log:

>>>

>>>     49 (gdb) file /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.cp/ambiguous/ambiguous^M

>>>     50 BFD: BFD (GNU Binutils) 2.37.50.20210924 assertion fail /home/simark/src/binutils-gdb/bfd/elf.c:240^M

>> 

>> Dependency problem?  I can't see that assert being hit unless you have

>> stale bfd object files.

>

> I tried rebuilding from scratch a few times and kept seeing it.  I

> flushed my ccache cache and now I don't see it, so perhaps it was a

> ccache issue (if so, that's quite rare).

>

> So, sorry for the noise.


Hi Simon,

no issue, I was trying to reproduce it but it's certainly better a false
alarm than a real one :)

Best Regards

  Andrea

Patch

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index c247d52c615..c7dedf522da 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1814,7 +1814,7 @@  struct bfd_elf_section_data
 #define LEAST_KNOWN_OBJ_ATTRIBUTE 2
 
 /* The maximum number of known object attributes for any target.  */
-#define NUM_KNOWN_OBJ_ATTRIBUTES 71
+#define NUM_KNOWN_OBJ_ATTRIBUTES 77
 
 /* The value of an object attribute.  The type indicates whether the attribute
    holds and integer, a string, or both.  It can also indicate that there can