Handle _DYNAMIC correctly in the x86_64 backend.

llvm-svn: 190302
This commit is contained in:
Joerg Sonnenberger 2013-09-09 12:19:28 +00:00
parent 23f8d43e5c
commit ecd1d9bc1d
3 changed files with 30 additions and 2 deletions

View File

@ -891,6 +891,31 @@ public:
virtual ArrayRef<uint8_t> rawContent() const { return ArrayRef<uint8_t>(); }
};
class DYNAMICAtom : public SimpleDefinedAtom {
public:
DYNAMICAtom(const File &f) : SimpleDefinedAtom(f) {}
virtual StringRef name() const { return "_DYNAMIC"; }
virtual Scope scope() const { return scopeLinkageUnit; }
virtual Merge merge() const { return mergeNo; }
virtual SectionChoice sectionChoice() const { return sectionCustomRequired; }
virtual StringRef customSectionName() const { return ".dynamic"; }
virtual ContentType contentType() const { return typeData; }
virtual uint64_t size() const { return 0; }
virtual ContentPermissions permissions() const { return permRW_; }
virtual Alignment alignment() const { return Alignment(0); }
virtual ArrayRef<uint8_t> rawContent() const { return ArrayRef<uint8_t>(); }
};
class InitFiniAtom : public SimpleDefinedAtom {
StringRef _section;

View File

@ -21,5 +21,7 @@ X86_64TargetHandler::X86_64TargetHandler(X86_64LinkingContext &context)
void X86_64TargetHandler::addFiles(InputFiles &f) {
_gotFile.addAtom(*new (_gotFile._alloc) GLOBAL_OFFSET_TABLEAtom(_gotFile));
_gotFile.addAtom(*new (_gotFile._alloc) TLSGETADDRAtom(_gotFile));
if (_context.isDynamic())
_gotFile.addAtom(*new (_gotFile._alloc) DYNAMICAtom(_gotFile));
f.appendFile(_gotFile);
}

View File

@ -12,8 +12,9 @@
# RUN: llvm-nm -n %t1 | FileCheck %s
#
# CHECK: 004001b0 T main
# CHECK: 00401000 A _end
# CHECK: 00401000 A end
# CHECK: 00401060 D _DYNAMIC
# CHECK: 00401060 A _end
# CHECK: 00401060 A end
# CHECK: U _entrypoint
defined-atoms: