From f0884e474cf6d460acc14d13a494ca9d6a5f0887 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 27 Feb 2018 20:37:18 +0000 Subject: [PATCH] Add `--dynamic-linker=foo` as an alias for `--dynamic-linker foo`. This patch fixes a minor compatibility issue with ld.gold and ld.bfd. llvm-svn: 326243 --- lld/ELF/Options.td | 1 + lld/test/ELF/dynamic-linker.s | 24 ++++++++++++++++++++++++ lld/test/ELF/no-dynamic-linker.s | 12 ------------ 3 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 lld/test/ELF/dynamic-linker.s delete mode 100644 lld/test/ELF/no-dynamic-linker.s diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index b849a2f..4637289 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -350,6 +350,7 @@ def alias_define_common_dc: F<"dc">, Alias; def alias_define_common_dp: F<"dp">, Alias; def alias_discard_all_x: Flag<["-"], "x">, Alias; def alias_discard_locals_X: Flag<["-"], "X">, Alias; +def alias_dynamic_linker_eq: J<"dynamic-linker=">, Alias; def alias_emit_relocs: Flag<["-"], "q">, Alias; def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias; def alias_export_dynamic_E: Flag<["-"], "E">, Alias; diff --git a/lld/test/ELF/dynamic-linker.s b/lld/test/ELF/dynamic-linker.s new file mode 100644 index 0000000..3faf8e8 --- /dev/null +++ b/lld/test/ELF/dynamic-linker.s @@ -0,0 +1,24 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t1.o +# RUN: ld.lld -shared %t1.o -o %t.so +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + +# RUN: ld.lld --dynamic-linker foo %t.o %t.so -o %t +# RUN: llvm-readelf -program-headers %t | FileCheck %s + +# RUN: ld.lld --dynamic-linker=foo %t.o %t.so -o %t +# RUN: llvm-readelf -program-headers %t | FileCheck %s + +# CHECK: [Requesting program interpreter: foo] + +# RUN: ld.lld %t.o %t.so -o %t +# RUN: llvm-readelf -program-headers %t | FileCheck --check-prefix=NO %s + +# RUN: ld.lld --dynamic-linker foo --no-dynamic-linker %t.o %t.so -o %t +# RUN: llvm-readelf -program-headers %t | FileCheck --check-prefix=NO %s + +# NO-NOT: PT_INTERP + +.globl _start +_start: + nop diff --git a/lld/test/ELF/no-dynamic-linker.s b/lld/test/ELF/no-dynamic-linker.s deleted file mode 100644 index f5c7f4b..0000000 --- a/lld/test/ELF/no-dynamic-linker.s +++ /dev/null @@ -1,12 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %tso.o -# RUN: ld.lld -shared %tso.o -o %t.so -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o - -# RUN: ld.lld -dynamic-linker foo --no-dynamic-linker %t.o %t.so -o %t -# RUN: llvm-readobj --program-headers %t | FileCheck %s --check-prefix=NODL -# NODL-NOT: PT_INTERP - -# RUN: ld.lld --no-dynamic-linker -dynamic-linker foo %t.o %t.so -o %t -# RUN: llvm-readobj --program-headers %t | FileCheck %s --check-prefix=WITHDL -# WITHDL: PT_INTERP -- 2.7.4