aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorClément Chigot <chigot@adacore.com>2023-10-06 14:38:40 +0200
committerClément Chigot <chigot@adacore.com>2023-10-13 16:23:39 +0200
commit4f6f3bea520d6575cc8fec1a0b094bb455a18b85 (patch)
treebe9fef16593f6f9b9bf18d7972bbb053b8a74473 /ld/emultempl
parent1eba15a501133ec305de6c34d89f401a7afc7998 (diff)
downloadgdb-4f6f3bea520d6575cc8fec1a0b094bb455a18b85.zip
gdb-4f6f3bea520d6575cc8fec1a0b094bb455a18b85.tar.gz
gdb-4f6f3bea520d6575cc8fec1a0b094bb455a18b85.tar.bz2
ld: warn when duplicated QNX stack note are detected
This warning is triggered only when a stack parameter is given to the linker. ld/ChangeLog: * emultempl/nto.em: Add warning when several QNX .note are detected.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/nto.em22
1 files changed, 18 insertions, 4 deletions
diff --git a/ld/emultempl/nto.em b/ld/emultempl/nto.em
index b1a6133..f4c76f1 100644
--- a/ld/emultempl/nto.em
+++ b/ld/emultempl/nto.em
@@ -86,6 +86,7 @@ nto_lookup_QNX_note_section(int type)
{
asection *stack_note_sec = NULL;
bfd *abfd;
+ bool duplicated_notes_detected = false;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
{
Elf_External_Note *e_note;
@@ -106,10 +107,23 @@ nto_lookup_QNX_note_section(int type)
e_note = (Elf_External_Note *) sec->contents;
if (! strcmp("QNX", e_note->name) && *e_note->type == type)
{
- stack_note_sec = sec;
- /* Allow modification of this .note content. */
- stack_note_sec->flags |= SEC_IN_MEMORY;
- break;
+ if (stack_note_sec)
+ {
+ if (!duplicated_notes_detected)
+ {
+ einfo (_("%P: %pB: warning: duplicated QNX stack .note detected\n"),
+ stack_note_sec->owner);
+ duplicated_notes_detected = true;
+ }
+ einfo (_("%P: %pB: warning: duplicated QNX stack .note detected\n"),
+ sec->owner);
+ }
+ else
+ {
+ stack_note_sec = sec;
+ /* Allow modification of this .note content. */
+ stack_note_sec->flags |= SEC_IN_MEMORY;
+ }
}
}