Skip to content

Commit 4f6f3be

Browse files
committed
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.
1 parent 1eba15a commit 4f6f3be

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

ld/emultempl/nto.em

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ nto_lookup_QNX_note_section(int type)
8686
{
8787
asection *stack_note_sec = NULL;
8888
bfd *abfd;
89+
bool duplicated_notes_detected = false;
8990
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
9091
{
9192
Elf_External_Note *e_note;
@@ -106,10 +107,23 @@ nto_lookup_QNX_note_section(int type)
106107
e_note = (Elf_External_Note *) sec->contents;
107108
if (! strcmp("QNX", e_note->name) && *e_note->type == type)
108109
{
109-
stack_note_sec = sec;
110-
/* Allow modification of this .note content. */
111-
stack_note_sec->flags |= SEC_IN_MEMORY;
112-
break;
110+
if (stack_note_sec)
111+
{
112+
if (!duplicated_notes_detected)
113+
{
114+
einfo (_("%P: %pB: warning: duplicated QNX stack .note detected\n"),
115+
stack_note_sec->owner);
116+
duplicated_notes_detected = true;
117+
}
118+
einfo (_("%P: %pB: warning: duplicated QNX stack .note detected\n"),
119+
sec->owner);
120+
}
121+
else
122+
{
123+
stack_note_sec = sec;
124+
/* Allow modification of this .note content. */
125+
stack_note_sec->flags |= SEC_IN_MEMORY;
126+
}
113127
}
114128
}
115129

0 commit comments

Comments
 (0)