[PATCH] D88615: [XCOFF] Enable explicit sections on AIX

Digger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 12:55:53 PST 2020


DiggerLin added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2088
     const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
-  report_fatal_error("XCOFF explicit sections not yet implemented.");
+  StringRef SectionName = GO->getSection();
+  XCOFF::StorageMappingClass MappingClass;
----------------
  /// If this global does not have a custom section, this will be empty and the
   /// default object file section (.text, .data, etc) will be used.
   StringRef getSection() const {
     return hasSection() ? getSectionImpl() : StringRef();
   }

do we need to check whether the Section Name is empty ?


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2285
+                         Func->isDeclaration() ? XCOFF::XTY_ER : XCOFF::XTY_SD,
+                         SectionKind::getText())
         ->getQualNameSymbol();
----------------
jasonliu wrote:
> DiggerLin wrote:
> > is there possible, something like ? 
> > 
> > int b __attribute__((section("a"))) = 2;
> > void a(void)  {
> > }
> > and compile with -function-section?
> I don't think that would be a problem as they still belongs to different sections.
> `b` would belong to `a[RW]`
> and function `a` would belong to `a[PR]`
thanks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88615/new/

https://reviews.llvm.org/D88615



More information about the llvm-commits mailing list