From b36fbbc3ec9fe0e1636c16d38083c65aefbafa7e Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 30 Jan 2018 16:29:29 +0000 Subject: CodeGen: support an extension to pass linker options on ELF Introduce an extension to support passing linker options to the linker. These would be ignored by older linkers, but newer linkers which support this feature would be able to process the linker. Emit a special discarded section `.linker-option`. The content of this section is a pair of strings (key, value). The key is a type identifier for the parameter. This allows for an argument free parameter that will be processed by the linker with the value being the parameter. As an example, `lib` identifies a library to be linked against, traditionally the `-l` argument for Unix-based linkers with the parameter being the library name. Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva for the valuable discussion on the design of this feature. llvm-svn: 323783 --- llvm/test/tools/llvm-readobj/elf-linker-options.ll | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 llvm/test/tools/llvm-readobj/elf-linker-options.ll (limited to 'llvm/test/tools/llvm-readobj') diff --git a/llvm/test/tools/llvm-readobj/elf-linker-options.ll b/llvm/test/tools/llvm-readobj/elf-linker-options.ll new file mode 100644 index 00000000000..6f96613c777 --- /dev/null +++ b/llvm/test/tools/llvm-readobj/elf-linker-options.ll @@ -0,0 +1,11 @@ +; RUN: llc -mtriple x86_64-elf -filetype obj -o - %s | llvm-readobj -elf-linker-options - | FileCheck %s + +!llvm.linker.options = !{!0, !1} + +!0 = !{!"option 0", !"value 0"} +!1 = !{!"option 1", !"value 1"} + +; CHECK: LinkerOptions [ +; CHECK: option 0: value 0 +; CHECK: option 1: value 1 +; CHECK: ] -- cgit v1.2.3