LegalizeTypes soft-float support for stores of a
[oota-llvm.git] / lib / CodeGen / ELFWriter.cpp
index 908abe5f1bba032e318bf3bcb2ffb7e2691c2f56..27f23f45cc0677af6a4466367e17eee8cb30e127 100644 (file)
@@ -50,11 +50,11 @@ using namespace llvm;
 char ELFWriter::ID = 0;
 /// AddELFWriter - Concrete function to add the ELF writer to the function pass
 /// manager.
-MachineCodeEmitter *llvm::AddELFWriter(FunctionPassManager &FPM,
+MachineCodeEmitter *llvm::AddELFWriter(PassManagerBase &PM,
                                        std::ostream &O,
                                        TargetMachine &TM) {
   ELFWriter *EW = new ELFWriter(O, TM);
-  FPM.add(EW);
+  PM.add(EW);
   return &EW->getMachineCodeEmitter();
 }
 
@@ -98,12 +98,28 @@ namespace llvm {
       return 0;
     }
 
+    virtual intptr_t getLabelAddress(uint64_t Label) const {
+      assert(0 && "Label address not implementated yet!");
+      abort();
+      return 0;
+    }
+
+    virtual void emitLabel(uint64_t LabelID) {
+      assert(0 && "emit Label not implementated yet!");
+      abort();
+    }
+
+
+    virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { }
+
+
     /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE!
-    void startFunctionStub(unsigned StubSize, unsigned Alignment = 1) {
+    void startFunctionStub(const GlobalValue* F, unsigned StubSize,
+                           unsigned Alignment = 1) {
       assert(0 && "JIT specific function called!");
       abort();
     }
-    void *finishFunctionStub(const Function *F) {
+    void *finishFunctionStub(const GlobalValue *F) {
       assert(0 && "JIT specific function called!");
       abort();
       return 0;
@@ -213,7 +229,7 @@ bool ELFWriter::doInitialization(Module &M) {
 
   // This should change for shared objects.
   FHOut.outhalf(1);                 // e_type = ET_REL
-  FHOut.outword(TM.getELFWriterInfo()->getEMachine()); // target-defined
+  FHOut.outhalf(TM.getELFWriterInfo()->getEMachine()); // target-defined
   FHOut.outword(1);                 // e_version = 1
   FHOut.outaddr(0);                 // e_entry = 0 -> no entry point in .o file
   FHOut.outaddr(0);                 // e_phoff = 0 -> no program header for .o
@@ -266,7 +282,8 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
     // If this global is part of the common block, add it now.  Variables are
     // part of the common block if they are zero initialized and allowed to be
     // merged with other symbols.
-    if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage()) {
+    if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
+        GV->hasCommonLinkage()) {
       ELFSym CommonSym(GV);
       // Value for common symbols is the alignment required.
       CommonSym.Value = Align;
@@ -297,7 +314,7 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
     BSSSym.SetType(ELFSym::STT_OBJECT);
 
     switch (GV->getLinkage()) {
-    default:  // weak/linkonce handled above
+    default:  // weak/linkonce/common handled above
       assert(0 && "Unexpected linkage type!");
     case GlobalValue::AppendingLinkage:  // FIXME: This should be improved!
     case GlobalValue::ExternalLinkage: