void MakeSymbolReal(COFFSymbol &S, size_t Index);
void MakeSectionReal(COFFSection &S, size_t Number);
+ bool ExportSymbol(MCSymbolData const &SymbolData, MCAssembler &Asm);
+
bool IsPhysicalSection(COFFSection *S);
// Entity writing methods.
S.Index = Index;
}
+bool WinCOFFObjectWriter::ExportSymbol(MCSymbolData const &SymbolData,
+ MCAssembler &Asm) {
+ // This doesn't seem to be right. Strings referred to from the .data section
+ // need symbols so they can be linked to code in the .text section right?
+
+ // return Asm.isSymbolLinkerVisible (&SymbolData);
+
+ // For now, all non-variable symbols are exported,
+ // the linker will sort the rest out for us.
+ return SymbolData.isExternal() || !SymbolData.getSymbol().isVariable();
+}
+
bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
return (S->Header.Characteristics
& COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0;
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
e = Asm.symbol_end();
- i != e; i++)
- DefineSymbol(*i, Asm, Layout);
+ i != e; i++) {
+ if (ExportSymbol(*i, Asm)) {
+ DefineSymbol(*i, Asm, Layout);
+ }
+ }
}
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
// cause the process to terminate immediately. LLVM does not know how to
// register any SEH handlers, so its object files should be safe.
S->setAbsolute();
+ OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
OutStreamer.EmitAssignment(
S, MCConstantExpr::Create(int64_t(1), MMI->getContext()));
}
// CHECK-NEXT: AuxSymbolCount: 0
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: external_aliased_to_local
-// CHECK-NEXT: Value: 0
-// CHECK-NEXT: Section: .text (1)
-// CHECK-NEXT: BaseType: Null (0x0)
-// CHECK-NEXT: ComplexType: Null (0x0)
-// CHECK-NEXT: StorageClass: Static (0x3)
-// CHECK-NEXT: AuxSymbolCount: 0
-// CHECK-NEXT: }
-// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: global_aliased_to_external
// CHECK-NEXT: Value: 0
// CHECK-NEXT: Section: (0)
// CHECK-NEXT: StorageClass: WeakExternal (0x69)
// CHECK-NEXT: AuxSymbolCount: 1
// CHECK-NEXT: AuxWeakExternal {
-// CHECK-NEXT: Linked: external2 (10)
+// CHECK-NEXT: Linked: external2 (9)
// CHECK-NEXT: Search: Library (0x2)
// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00)
// CHECK-NEXT: }