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