diff options
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index f417a30..dbe0697 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1176,8 +1176,22 @@ wild_doit (ptr, section, output, file) if (! first && (section->output_section->flags & SEC_READONLY) == 0) flags &= ~ SEC_READONLY; + /* Keep SEC_MERGE and SEC_STRINGS only if they are the same. */ + if (! first + && ((section->output_section->flags & (SEC_MERGE | SEC_STRINGS)) + != (flags & (SEC_MERGE | SEC_STRINGS)) + || ((flags & SEC_MERGE) + && section->output_section->entsize != section->entsize))) + { + section->output_section->flags &= ~ (SEC_MERGE | SEC_STRINGS); + flags &= ~ (SEC_MERGE | SEC_STRINGS); + } + section->output_section->flags |= flags; + if (flags & SEC_MERGE) + section->output_section->entsize = section->entsize; + /* If SEC_READONLY is not set in the input section, then clear it from the output section. */ if ((section->flags & SEC_READONLY) == 0) |