summaryrefslogtreecommitdiff
path: root/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-14 15:39:25 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-14 15:39:25 +0000
commit1eafc0458f4bb4547fe78c62b78312ad4f719c38 (patch)
treedb247ebc1d3d05750e31ef4b162cf9ab4af9ddef /ELF/OutputSections.cpp
parentb047fead11133644be3dbae34b85be39ce2819e9 (diff)
Notes
Diffstat (limited to 'ELF/OutputSections.cpp')
-rw-r--r--ELF/OutputSections.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/ELF/OutputSections.cpp b/ELF/OutputSections.cpp
index a9d951dcc745..7c708ce4ed67 100644
--- a/ELF/OutputSections.cpp
+++ b/ELF/OutputSections.cpp
@@ -636,7 +636,12 @@ OutputSectionFactory<ELFT>::create(const SectionKey &Key,
if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(C->Flags))
error("Section has flags incompatible with others with the same name " +
toString(C));
- if (Sec->Type != C->Type)
+ // Convert notbits to progbits if they are mixed. This happens is some
+ // linker scripts.
+ if (Sec->Type == SHT_NOBITS && C->Type == SHT_PROGBITS)
+ Sec->Type = SHT_PROGBITS;
+ if (Sec->Type != C->Type &&
+ !(Sec->Type == SHT_PROGBITS && C->Type == SHT_NOBITS))
error("Section has different type from others with the same name " +
toString(C));
Sec->Flags |= Flags;