summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2016-12-21 05:31:57 +0000
committerSimon Atanasyan <simon@atanasyan.com>2016-12-21 05:31:57 +0000
commit86dc60d8d4c7cc720f578e4a18fa2664483bc186 (patch)
tree326837dde143448aa2317350caa3ccc6e749335e /lld/ELF/SyntheticSections.cpp
parentb6a8f02251fce3cb74dad472940e7717ecafc048 (diff)
downloadbcm5719-llvm-86dc60d8d4c7cc720f578e4a18fa2664483bc186.tar.gz
bcm5719-llvm-86dc60d8d4c7cc720f578e4a18fa2664483bc186.zip
[ELF][MIPS] Allow .MIPS.abiflags larger than one Elf_Mips_ABIFlags struct
Older versions of BFD generate libraries with .MIPS.abiflags that only concatenate the individual .MIPS.abiflags sections instead of merging. Patch by Alexander Richardson. Differential revision: https://reviews.llvm.org/D27770 llvm-svn: 290237
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index ea5e924e493..2dbe749029c 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -134,8 +134,13 @@ MipsAbiFlagsSection<ELFT> *MipsAbiFlagsSection<ELFT>::create() {
Create = true;
std::string Filename = toString(Sec->getFile());
- if (Sec->Data.size() != sizeof(Elf_Mips_ABIFlags)) {
- error(Filename + ": invalid size of .MIPS.abiflags section");
+ const size_t Size = Sec->Data.size();
+ // Older version of BFD (such as the default FreeBSD linker) concatenate
+ // .MIPS.abiflags instead of merging. To allow for this case (or potential
+ // zero padding) we ignore everything after the first Elf_Mips_ABIFlags
+ if (Size < sizeof(Elf_Mips_ABIFlags)) {
+ error(Filename + ": invalid size of .MIPS.abiflags section: got " +
+ Twine(Size) + " instead of " + Twine(sizeof(Elf_Mips_ABIFlags)));
return nullptr;
}
auto *S = reinterpret_cast<const Elf_Mips_ABIFlags *>(Sec->Data.data());
OpenPOWER on IntegriCloud