| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //===- lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h ------------===// | ||
| // | ||
| // The LLVM Linker | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef AARCH64_RELOCATION_HANDLER_H | ||
| #define AARCH64_RELOCATION_HANDLER_H | ||
|
|
||
| #include "AArch64TargetHandler.h" | ||
|
|
||
| namespace lld { | ||
| namespace elf { | ||
| typedef llvm::object::ELFType<llvm::support::little, 2, true> AArch64ELFType; | ||
|
|
||
| template <class ELFT> class AArch64TargetLayout; | ||
|
|
||
| class AArch64TargetRelocationHandler final | ||
| : public TargetRelocationHandler<AArch64ELFType> { | ||
| public: | ||
| AArch64TargetRelocationHandler(AArch64TargetLayout<AArch64ELFType> &layout) | ||
| : _tlsSize(0), _AArch64Layout(layout) {} | ||
|
|
||
| std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &, | ||
| const lld::AtomLayout &, | ||
| const Reference &) const override; | ||
|
|
||
| virtual int64_t relocAddend(const Reference &) const; | ||
|
|
||
| static const Registry::KindStrings kindStrings[]; | ||
|
|
||
| private: | ||
| // Cached size of the TLS segment. | ||
| mutable uint64_t _tlsSize; | ||
| AArch64TargetLayout<AArch64ELFType> &_AArch64Layout; | ||
| }; | ||
|
|
||
| } // end namespace elf | ||
| } // end namespace lld | ||
|
|
||
| #endif // AArch64_RELOCATION_HANDLER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //===- lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.h ---------------===// | ||
| // | ||
| // The LLVM Linker | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// | ||
| /// \file | ||
| /// \brief Declares the relocation processing pass for x86-64. This includes | ||
| /// GOT and PLT entries, TLS, COPY, and ifunc. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_RELOCATION_PASS_H | ||
| #define LLD_READER_WRITER_ELF_AARCH64_AARCH64_RELOCATION_PASS_H | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace lld { | ||
| class Pass; | ||
| namespace elf { | ||
| class AArch64LinkingContext; | ||
|
|
||
| /// \brief Create AArch64 relocation pass for the given linking context. | ||
| std::unique_ptr<Pass> | ||
| createAArch64RelocationPass(const AArch64LinkingContext &); | ||
| } | ||
| } | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| //===- lib/ReaderWriter/ELF/AArch64/AArch64Target.h -----------------------===// | ||
| // | ||
| // The LLVM Linker | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "AArch64LinkingContext.h" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| //===- lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp --------------===// | ||
| // | ||
| // The LLVM Linker | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "Atoms.h" | ||
| #include "AArch64ExecutableWriter.h" | ||
| #include "AArch64DynamicLibraryWriter.h" | ||
| #include "AArch64TargetHandler.h" | ||
| #include "AArch64LinkingContext.h" | ||
|
|
||
| using namespace lld; | ||
| using namespace elf; | ||
|
|
||
| AArch64TargetHandler::AArch64TargetHandler(AArch64LinkingContext &context) | ||
| : DefaultTargetHandler(context), _context(context), | ||
| _AArch64TargetLayout(new AArch64TargetLayout<AArch64ELFType>(context)), | ||
| _AArch64RelocationHandler( | ||
| new AArch64TargetRelocationHandler(*_AArch64TargetLayout.get())) {} | ||
|
|
||
| void AArch64TargetHandler::registerRelocationNames(Registry ®istry) { | ||
| registry.addKindTable(Reference::KindNamespace::ELF, | ||
| Reference::KindArch::AArch64, kindStrings); | ||
| } | ||
|
|
||
| std::unique_ptr<Writer> AArch64TargetHandler::getWriter() { | ||
| switch (this->_context.getOutputELFType()) { | ||
| case llvm::ELF::ET_EXEC: | ||
| return std::unique_ptr<Writer>(new AArch64ExecutableWriter<AArch64ELFType>( | ||
| _context, *_AArch64TargetLayout.get())); | ||
| case llvm::ELF::ET_DYN: | ||
| return std::unique_ptr<Writer>( | ||
| new AArch64DynamicLibraryWriter<AArch64ELFType>( | ||
| _context, *_AArch64TargetLayout.get())); | ||
| case llvm::ELF::ET_REL: | ||
| llvm_unreachable("TODO: support -r mode"); | ||
| default: | ||
| llvm_unreachable("unsupported output type"); | ||
| } | ||
| } | ||
|
|
||
| const Registry::KindStrings AArch64TargetHandler::kindStrings[] = { | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_NONE), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ABS64), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ABS32), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ABS16), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_PREL64), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_PREL32), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_PREL16), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G0), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G0_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G1), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G1_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G2), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G2_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_UABS_G3), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_SABS_G0), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_SABS_G1), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_MOVW_SABS_G2), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LD_PREL_LO19), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ADR_PREL_LO21), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ADR_PREL_PG_HI21), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ADD_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LDST8_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TSTBR14), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_CONDBR19), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_JUMP26), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_CALL26), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LDST16_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LDST32_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LDST64_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LDST128_ABS_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_ADR_GOT_PAGE), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_LD64_GOT_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_MOVW_DTPREL_G2), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_MOVW_DTPREL_G1), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_MOVW_DTPREL_G0), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_ADD_DTPREL_HI12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_ADD_DTPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST8_DTPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST16_DTPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST32_DTPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST64_DTPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_MOVW_TPREL_G2), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_MOVW_TPREL_G1), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_MOVW_TPREL_G0), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_ADD_TPREL_HI12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_ADD_TPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST8_TPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST16_TPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST32_TPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST64_TPREL_LO12), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSDESC_ADR_PAGE), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSDESC_LD64_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSDESC_ADD_LO12_NC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSDESC_CALL), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_COPY), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_GLOB_DAT), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_JUMP_SLOT), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_RELATIVE), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLS_DTPREL64), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLS_DTPMOD64), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLS_TPREL64), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_TLSDESC), | ||
| LLD_KIND_STRING_ENTRY(R_AARCH64_IRELATIVE), | ||
| LLD_KIND_STRING_END}; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| //===- lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h ----------------===// | ||
| // | ||
| // The LLVM Linker | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H | ||
| #define LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H | ||
|
|
||
| #include "DefaultTargetHandler.h" | ||
| #include "ELFFile.h" | ||
| #include "AArch64RelocationHandler.h" | ||
| #include "TargetLayout.h" | ||
|
|
||
| #include "lld/Core/Simple.h" | ||
|
|
||
| namespace lld { | ||
| namespace elf { | ||
| typedef llvm::object::ELFType<llvm::support::little, 2, true> AArch64ELFType; | ||
| class AArch64LinkingContext; | ||
|
|
||
| template <class ELFT> class AArch64TargetLayout : public TargetLayout<ELFT> { | ||
| public: | ||
| AArch64TargetLayout(AArch64LinkingContext &context) | ||
| : TargetLayout<ELFT>(context) {} | ||
| }; | ||
|
|
||
| class AArch64TargetHandler final : public DefaultTargetHandler<AArch64ELFType> { | ||
| public: | ||
| AArch64TargetHandler(AArch64LinkingContext &context); | ||
|
|
||
| AArch64TargetLayout<AArch64ELFType> &getTargetLayout() override { | ||
| return *(_AArch64TargetLayout.get()); | ||
| } | ||
|
|
||
| void registerRelocationNames(Registry ®istry) override; | ||
|
|
||
| const AArch64TargetRelocationHandler &getRelocationHandler() const override { | ||
| return *(_AArch64RelocationHandler.get()); | ||
| } | ||
|
|
||
| std::unique_ptr<Writer> getWriter() override; | ||
|
|
||
| private: | ||
| static const Registry::KindStrings kindStrings[]; | ||
| AArch64LinkingContext &_context; | ||
| std::unique_ptr<AArch64TargetLayout<AArch64ELFType>> _AArch64TargetLayout; | ||
| std::unique_ptr<AArch64TargetRelocationHandler> _AArch64RelocationHandler; | ||
| }; | ||
|
|
||
| } // end namespace elf | ||
| } // end namespace lld | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| add_lld_library(lldAArch64ELFTarget | ||
| AArch64LinkingContext.cpp | ||
| AArch64TargetHandler.cpp | ||
| AArch64RelocationHandler.cpp | ||
| AArch64RelocationPass.cpp | ||
| ) | ||
|
|
||
| target_link_libraries(lldAArch64ELFTarget | ||
| lldCore | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ##===- lld/lib/ReaderWriter/ELF/AArch64/Makefile ----------*- Makefile -*-===## | ||
| # | ||
| # The LLVM Compiler Infrastructure | ||
| # | ||
| # This file is distributed under the University of Illinois Open Source | ||
| # License. See LICENSE.TXT for details. | ||
| # | ||
| ##===----------------------------------------------------------------------===## | ||
|
|
||
| LLD_LEVEL := ../../../.. | ||
| LIBRARYNAME := lldAArch64ELFTarget | ||
| USEDLIBS = lldCore.a | ||
| CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF/AArch64 -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF | ||
|
|
||
| include $(LLD_LEVEL)/Makefile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ELF AArch64 | ||
| ~~~~~~~~~~ | ||
|
|
||
| Unimplemented Features | ||
| ###################### | ||
|
|
||
| * Just about everything! | ||
|
|
||
| Unimplemented Relocations | ||
| ######################### | ||
|
|
||
| All of these relocations are defined in: | ||
| http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| int fn() | ||
| { | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #include <stdio.h> | ||
|
|
||
| void init() { | ||
| printf("%s\n", __FUNCTION__); | ||
| } | ||
|
|
||
| void fini() { | ||
| printf("%s\n", __FUNCTION__); | ||
| } | ||
|
|
||
| int main() { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #include <stdio.h> | ||
|
|
||
| void __attribute__ ((constructor)) constructor() { | ||
| printf("%s\n", __FUNCTION__); | ||
| } | ||
|
|
||
| void __attribute__ ((destructor)) destructor() { | ||
| printf("%s\n", __FUNCTION__); | ||
| } | ||
|
|
||
| int main() { | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| int main() { | ||
| fn(); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| int c = 10; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .text | ||
| .data | ||
| .word .text |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| RUN: lld -flavor gnu -target aarch64--linux-gnu --defsym=main=fn \ | ||
| RUN: --noinhibit-exec %p/Inputs/fn.o -o %t | ||
| RUN: llvm-readobj -symbols %t | FileCheck %s | ||
|
|
||
| CHECK: Symbol { | ||
| CHECK: Name: main (1) | ||
| CHECK: Value: 0x4001A4 | ||
| CHECK: Size: 0 | ||
| CHECK: Binding: Global (0x1) | ||
| CHECK: Type: Function (0x2) | ||
| CHECK: Other: 0 | ||
| CHECK: Section: .text (0x5) | ||
| CHECK: } | ||
| CHECK: Symbol { | ||
| CHECK: Name: fn (6) | ||
| CHECK: Value: 0x4001A4 | ||
| CHECK: Size: 8 | ||
| CHECK: Binding: Global (0x1) | ||
| CHECK: Type: Function (0x2) | ||
| CHECK: Other: 0 | ||
| CHECK: Section: .text (0x5) | ||
| CHECK: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # This tests that lld is not ignoring zero sized sections | ||
| RUN: lld -flavor gnu -target aarch64--linux-gnu %p/Inputs/zerosizedsection.o \ | ||
| RUN: --noinhibit-exec --output-filetype=yaml -o %t | ||
| RUN: FileCheck %s < %t | ||
|
|
||
| CHECK: references: | ||
| CHECK: - kind: layout-after | ||
| CHECK: offset: 0 | ||
| CHECK: target: L000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| RUN: lld -flavor gnu -target aarch64--linux-gnu %p/Inputs/no-interp-section.o \ | ||
| RUN: -o %t -shared | ||
| RUN: llvm-objdump -section-headers %t | FileCheck %s | ||
|
|
||
| CHECK-NOT: .interp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # This tests the functionality that lld is able to create | ||
| # init_array/fini_array sections in the output ELF with the | ||
| # right alignment | ||
|
|
||
| RUN: lld -flavor gnu -target aarch64--linux-gnu %p/Inputs/initfini-option.o \ | ||
| RUN: -init init -fini fini --noinhibit-exec -o %t | ||
| RUN: llvm-readobj -s %t | FileCheck %s | ||
|
|
||
| CHECK: Name: .init_array | ||
| CHECK: AddressAlignment: 8 | ||
| CHECK: Name: .fini_array | ||
| CHECK: AddressAlignment: 8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # This tests the functionality that lld is able to create | ||
| # init_array/fini_array sections in the output ELF. This | ||
| # corresponds to the the .init_array/.fini_array sections | ||
| # in the output ELF. | ||
|
|
||
| RUN: lld -flavor gnu -target aarch64--linux-gnu %p/Inputs/initfini-option.o \ | ||
| RUN: -init init -fini fini --noinhibit-exec --output-filetype=yaml -static -o %t | ||
| RUN: FileCheck %s < %t | ||
|
|
||
| CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] | ||
| CHECK: section-name: .init_array | ||
| CHECK: references: | ||
| CHECK: - kind: R_AARCH64_ABS64 | ||
| CHECK: offset: 0 | ||
| CHECK: target: init | ||
| CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] | ||
| CHECK: section-name: .fini_array | ||
| CHECK: references: | ||
| CHECK: - kind: R_AARCH64_ABS64 | ||
| CHECK: offset: 0 | ||
| CHECK: target: fini |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # This tests the functionality that lld is able to read | ||
| # init_array/fini_array sections in the input ELF. This | ||
| # corresponds to the the .init_array/.fini_array sections | ||
| # in the output ELF. | ||
|
|
||
| RUN: lld -flavor gnu -target aarch64--linux-gnu %p/Inputs/initfini.o \ | ||
| RUN: --noinhibit-exec --output-filetype=yaml -o %t | ||
| RUN: FileCheck %s < %t | ||
|
|
||
| CHECK: type: data | ||
| CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] | ||
| CHECK: section-name: .init_array | ||
| CHECK: references: | ||
| CHECK: - kind: R_AARCH64_ABS64 | ||
| CHECK: offset: 0 | ||
| CHECK: target: constructor | ||
| CHECK: type: data | ||
| CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] | ||
| CHECK: section-name: .fini_array | ||
| CHECK: references: | ||
| CHECK: - kind: R_AARCH64_ABS64 | ||
| CHECK: offset: 0 | ||
| CHECK: target: destructor |