Fix llvm-gcc bootstrap with gnu ld.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 24 Feb 2011 20:18:01 +0000 (20:18 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 24 Feb 2011 20:18:01 +0000 (20:18 +0000)
The problem was codegen guessing the wrong values and printing

.section .eh_frame,"aMS",@progbits,4

It is not clear at all if Codegen should try to guess, MC is the
one that should know the default flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126421 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetLoweringObjectFileImpl.cpp

index e4d9ee02e7ca15d4c387fa6fc567a9884e4bac7b..fa311dc5d66c5b4fb33011d4a4458b853366fe24 100644 (file)
@@ -178,6 +178,10 @@ const MCSection *TargetLoweringObjectFileELF::getEHFrameSection() const {
 
 static SectionKind
 getELFKindForNamedSection(StringRef Name, SectionKind K) {
+  // FIXME: Why is this here? Codegen is should not be in the business
+  // of figuring section flags. If the user wrote section(".eh_frame"),
+  // we should just pass that to MC which will defer to the assembly
+  // or use its default if producing an object file.
   if (Name.empty() || Name[0] != '.') return K;
 
   // Some lame default implementation based on some magic section names.
@@ -203,6 +207,9 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) {
       Name.startswith(".llvm.linkonce.tb."))
     return SectionKind::getThreadBSS();
 
+  if (Name == ".eh_frame")
+    return SectionKind::getDataRel();
+
   return K;
 }