aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ELFTargetAsmInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-24 17:02:17 +0000
committerChris Lattner <sabre@nondot.org>2009-07-24 17:02:17 +0000
commit2dcafe4b8f84cdb0d084421f11cdca08cd6b951d (patch)
tree9bcca60ce6efe7e72eeedcd834fabb1a04066d99 /lib/Target/ELFTargetAsmInfo.cpp
parente5ca0ac36be44057ba5a5ad300c685b7967ff5ec (diff)
move ELF-specific code into ELFTargetAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76976 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ELFTargetAsmInfo.cpp')
-rw-r--r--lib/Target/ELFTargetAsmInfo.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp
index 662fc11f20..6ab9efb489 100644
--- a/lib/Target/ELFTargetAsmInfo.cpp
+++ b/lib/Target/ELFTargetAsmInfo.cpp
@@ -145,6 +145,33 @@ ELFTargetAsmInfo::getSectionForMergableConstant(uint64_t Size,
return getReadOnlySection(); // .rodata
}
+/// getFlagsForNamedSection - If this target wants to be able to infer
+/// section flags based on the name of the section specified for a global
+/// variable, it can implement this.
+unsigned ELFTargetAsmInfo::getFlagsForNamedSection(const char *Name) const {
+ unsigned Flags = 0;
+ if (Name[0] != '.') return 0;
+
+ // Some lame default implementation based on some magic section names.
+ if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 ||
+ strncmp(Name, ".llvm.linkonce.b.", 17) == 0 ||
+ strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 ||
+ strncmp(Name, ".llvm.linkonce.sb.", 18) == 0)
+ Flags |= SectionFlags::BSS;
+ else if (strcmp(Name, ".tdata") == 0 ||
+ strncmp(Name, ".tdata.", 7) == 0 ||
+ strncmp(Name, ".gnu.linkonce.td.", 17) == 0 ||
+ strncmp(Name, ".llvm.linkonce.td.", 18) == 0)
+ Flags |= SectionFlags::TLS;
+ else if (strcmp(Name, ".tbss") == 0 ||
+ strncmp(Name, ".tbss.", 6) == 0 ||
+ strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 ||
+ strncmp(Name, ".llvm.linkonce.tb.", 18) == 0)
+ Flags |= SectionFlags::BSS | SectionFlags::TLS;
+
+ return Flags;
+}
+
const Section*
ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {