This update does the following:
* Moves enum Scope from DefinedAtom.h to Atom.h
* Adds scope method to AbsoluteAtom class
* Updates YAML to print scope of AbsoluteAtoms
* Update Native Reader/Writer to handle this new, "attribute"
* Adds testcase
Reviewed and approved by Nick Kledzik
llvm-svn: 166189
diff --git a/lld/lib/ReaderWriter/ELF/WriterELF.cpp b/lld/lib/ReaderWriter/ELF/WriterELF.cpp
index 974e829..13453b7 100644
--- a/lld/lib/ReaderWriter/ELF/WriterELF.cpp
+++ b/lld/lib/ReaderWriter/ELF/WriterELF.cpp
@@ -601,14 +601,28 @@
b = ELF::STB_WEAK;
else
b = ELF::STB_GLOBAL;
- } else if (const AbsoluteAtom *aa = llvm::dyn_cast<const AbsoluteAtom>(a)){
+ } else if (const AbsoluteAtom *aa = llvm::dyn_cast<const AbsoluteAtom>(a)){
//FIXME: Absolute atoms need more properties to differentiate each other
// based on binding and type of symbol
- symbol->st_value = aa->value();
+ t = ELF::STT_OBJECT;
+
+ switch (aa->scope()) {
+ case AbsoluteAtom::scopeLinkageUnit:
+ symbol->st_other = ELF::STV_HIDDEN;
+ b = ELF::STB_LOCAL;
+ break;
+ case AbsoluteAtom::scopeTranslationUnit:
+ b = ELF::STB_LOCAL;
+ break;
+ case AbsoluteAtom::scopeGlobal:
+ b = ELF::STB_GLOBAL;
+ break;
+ }
+ symbol->st_value = aa->value();
} else {
- symbol->st_value = 0;
- t = ELF::STT_NOTYPE;
- b = ELF::STB_LOCAL;
+ symbol->st_value = 0;
+ t = ELF::STT_NOTYPE;
+ b = ELF::STB_LOCAL;
}
symbol->setBindingAndType(b, t);