return flags;
}
-// GNU assembler 2.24 and LLVM 4.0.0's MC (the newest release as of
-// March 2017) fail to infer section types for sections starting with
-// ".init_array." or ".fini_array.". They set SHT_PROGBITS instead of
-// SHF_INIT_ARRAY. As a result, the following assembler directive
-// creates ".init_array.100" with SHT_PROGBITS, for example.
-//
-// .section .init_array.100, "aw"
-//
-// This function forces SHT_{INIT,FINI}_ARRAY so that we can handle
-// incorrect inputs as if they were correct from the beginning.
-static uint64_t getType(uint64_t type, StringRef name) {
- if (type == SHT_PROGBITS && name.startswith(".init_array."))
- return SHT_INIT_ARRAY;
- if (type == SHT_PROGBITS && name.startswith(".fini_array."))
- return SHT_FINI_ARRAY;
- return type;
-}
-
template <class ELFT>
InputSectionBase::InputSectionBase(ObjFile<ELFT> &file,
const typename ELFT::Shdr &hdr,
StringRef name, Kind sectionKind)
- : InputSectionBase(&file, getFlags(hdr.sh_flags),
- getType(hdr.sh_type, name), hdr.sh_entsize, hdr.sh_link,
- hdr.sh_info, hdr.sh_addralign,
- getSectionContents(file, hdr), name, sectionKind) {
+ : InputSectionBase(&file, getFlags(hdr.sh_flags), hdr.sh_type,
+ hdr.sh_entsize, hdr.sh_link, hdr.sh_info,
+ hdr.sh_addralign, getSectionContents(file, hdr), name,
+ sectionKind) {
// We reject object files having insanely large alignments even though
// they are allowed by the spec. I think 4GB is a reasonable limitation.
// We might want to relax this in the future.