[lld] r237898 - [ARM] Add dynamic symbols to the dynamic library writer
Denis Protivensky
dprotivensky at accesssoftek.com
Thu May 21 05:52:00 PDT 2015
Author: denis-protivensky
Date: Thu May 21 07:52:00 2015
New Revision: 237898
URL: http://llvm.org/viewvc/llvm-project?rev=237898&view=rev
Log:
[ARM] Add dynamic symbols to the dynamic library writer
Modified:
lld/trunk/lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h
lld/trunk/test/elf/ARM/dynamic-symbols.test
Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h?rev=237898&r1=237897&r2=237898&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h Thu May 21 07:52:00 2015
@@ -25,15 +25,22 @@ public:
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
+
+private:
+ ARMLinkingContext &_ctx;
};
ARMDynamicLibraryWriter::ARMDynamicLibraryWriter(ARMLinkingContext &ctx,
ARMTargetLayout &layout)
- : ARMELFWriter(ctx, layout) {}
+ : ARMELFWriter(ctx, layout), _ctx(ctx) {}
void ARMDynamicLibraryWriter::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter::createImplicitFiles(result);
+ auto file = llvm::make_unique<RuntimeFile<ELF32LE>>(_ctx, "ARM dynamic file");
+ file->addAbsoluteAtom(gotSymbol);
+ file->addAbsoluteAtom(dynamicSymbol);
+ result.push_back(std::move(file));
}
} // namespace elf
Modified: lld/trunk/test/elf/ARM/dynamic-symbols.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ARM/dynamic-symbols.test?rev=237898&r1=237897&r2=237898&view=diff
==============================================================================
--- lld/trunk/test/elf/ARM/dynamic-symbols.test (original)
+++ lld/trunk/test/elf/ARM/dynamic-symbols.test Thu May 21 07:52:00 2015
@@ -14,20 +14,40 @@
# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=EXEC-DYN %s
# EXEC-DYN: Name: _GLOBAL_OFFSET_TABLE_
-# EXEC-DYN-NEXT: Value: {{[0-9]+}}
+# EXEC-DYN-NEXT: Value: 0x401000
# EXEC-DYN-NEXT: Size: 0
# EXEC-DYN-NEXT: Binding: Global (0x1)
# EXEC-DYN-NEXT: Type: Object (0x1)
# EXEC-DYN-NEXT: Other: 0
# EXEC-DYN-NEXT: Section: Absolute (0xFFF1)
# EXEC-DYN: Name: _DYNAMIC
-# EXEC-DYN-NEXT: Value: {{[0-9]+}}
+# EXEC-DYN-NEXT: Value: 0x400130
# EXEC-DYN-NEXT: Size: 0
# EXEC-DYN-NEXT: Binding: Global (0x1)
# EXEC-DYN-NEXT: Type: Object (0x1)
# EXEC-DYN-NEXT: Other: 0
# EXEC-DYN-NEXT: Section: Absolute (0xFFF1)
+# RUN: yaml2obj -format=elf %s > %t-o.o
+# RUN: lld -flavor gnu -target arm-linux-gnu \
+# RUN: -shared --noinhibit-exec %t-o.o -o %t
+# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=SHARED %s
+
+# SHARED: Name: _GLOBAL_OFFSET_TABLE_
+# SHARED-NEXT: Value: 0x401000
+# SHARED-NEXT: Size: 0
+# SHARED-NEXT: Binding: Global (0x1)
+# SHARED-NEXT: Type: Object (0x1)
+# SHARED-NEXT: Other: 0
+# SHARED-NEXT: Section: Absolute (0xFFF1)
+# SHARED: Name: _DYNAMIC
+# SHARED-NEXT: Value: 0x4000EC
+# SHARED-NEXT: Size: 0
+# SHARED-NEXT: Binding: Global (0x1)
+# SHARED-NEXT: Type: Object (0x1)
+# SHARED-NEXT: Other: 0
+# SHARED-NEXT: Section: Absolute (0xFFF1)
+
---
FileHeader:
Class: ELFCLASS32
@@ -51,6 +71,11 @@ Sections:
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
+ - Name: .got
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+ Content: 0000
Symbols:
Global:
- Name: main
More information about the llvm-commits
mailing list