Start mass upgrade
[dragora.git] / patches / binutils / 2.35 / binutils-duplicate-sections.patch
blob441bb2eecdb1b5aab9b24e1d994dc7a547229d46
1 diff -rup binutils.orig/ld/ldlang.c binutils-2.35.1/ld/ldlang.c
2 --- binutils.orig/ld/ldlang.c 2021-01-04 15:20:32.901498036 +0000
3 +++ binutils-2.35.1/ld/ldlang.c 2021-01-04 15:22:03.151916333 +0000
4 @@ -1529,6 +1529,8 @@ lang_output_section_statement_lookup (co
6 entry->s.output_section_statement.name = name;
7 entry->s.output_section_statement.constraint = constraint;
8 + entry->s.output_section_statement.dup_output = (create == 2
9 + || constraint == SPECIAL);
10 return &entry->s.output_section_statement;
13 @@ -2390,7 +2392,7 @@ init_os (lang_output_section_statement_t
14 if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
15 einfo (_("%F%P: illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
17 - if (s->constraint != SPECIAL)
18 + if (!s->dup_output)
19 s->bfd_section = bfd_get_section_by_name (link_info.output_bfd, s->name);
20 if (s->bfd_section == NULL)
21 s->bfd_section = bfd_make_section_anyway_with_flags (link_info.output_bfd,
22 diff -rup binutils.orig/ld/ldlang.h binutils-2.35.1/ld/ldlang.h
23 --- binutils.orig/ld/ldlang.h 2021-01-04 15:20:32.627499830 +0000
24 +++ binutils-2.35.1/ld/ldlang.h 2021-01-04 15:21:06.688277003 +0000
25 @@ -173,6 +173,9 @@ typedef struct lang_output_section_state
26 unsigned int after_end : 1;
27 /* If this section uses the alignment of its input sections. */
28 unsigned int align_lma_with_input : 1;
29 + /* If script has duplicate output section statements of the same name
30 + create duplicate output sections. */
31 + unsigned int dup_output : 1;
32 } lang_output_section_statement_type;
34 typedef struct