|
|
2e9b04 |
diff -rup binutils.orig/ld/ldlang.c binutils-2.35.1/ld/ldlang.c
|
|
|
2e9b04 |
--- binutils.orig/ld/ldlang.c 2021-01-04 15:20:32.901498036 +0000
|
|
|
2e9b04 |
+++ binutils-2.35.1/ld/ldlang.c 2021-01-04 15:22:03.151916333 +0000
|
|
|
2e9b04 |
@@ -1529,6 +1529,8 @@ lang_output_section_statement_lookup (co
|
|
|
2e9b04 |
|
|
|
2e9b04 |
entry->s.output_section_statement.name = name;
|
|
|
2e9b04 |
entry->s.output_section_statement.constraint = constraint;
|
|
|
2e9b04 |
+ entry->s.output_section_statement.dup_output = (create == 2
|
|
|
2e9b04 |
+ || constraint == SPECIAL);
|
|
|
2e9b04 |
return &entry->s.output_section_statement;
|
|
|
2e9b04 |
}
|
|
|
2e9b04 |
|
|
|
2e9b04 |
@@ -2390,7 +2392,7 @@ init_os (lang_output_section_statement_t
|
|
|
2e9b04 |
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
|
|
|
2e9b04 |
einfo (_("%F%P: illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
|
|
|
2e9b04 |
|
|
|
2e9b04 |
- if (s->constraint != SPECIAL)
|
|
|
2e9b04 |
+ if (!s->dup_output)
|
|
|
2e9b04 |
s->bfd_section = bfd_get_section_by_name (link_info.output_bfd, s->name);
|
|
|
2e9b04 |
if (s->bfd_section == NULL)
|
|
|
2e9b04 |
s->bfd_section = bfd_make_section_anyway_with_flags (link_info.output_bfd,
|
|
|
2e9b04 |
diff -rup binutils.orig/ld/ldlang.h binutils-2.35.1/ld/ldlang.h
|
|
|
2e9b04 |
--- binutils.orig/ld/ldlang.h 2021-01-04 15:20:32.627499830 +0000
|
|
|
2e9b04 |
+++ binutils-2.35.1/ld/ldlang.h 2021-01-04 15:21:06.688277003 +0000
|
|
|
2e9b04 |
@@ -173,6 +173,9 @@ typedef struct lang_output_section_state
|
|
|
2e9b04 |
unsigned int after_end : 1;
|
|
|
2e9b04 |
/* If this section uses the alignment of its input sections. */
|
|
|
2e9b04 |
unsigned int align_lma_with_input : 1;
|
|
|
2e9b04 |
+ /* If script has duplicate output section statements of the same name
|
|
|
2e9b04 |
+ create duplicate output sections. */
|
|
|
2e9b04 |
+ unsigned int dup_output : 1;
|
|
|
2e9b04 |
} lang_output_section_statement_type;
|
|
|
2e9b04 |
|
|
|
2e9b04 |
typedef struct
|