From 11202deb4ae13a17a5768a8f9aeefd4e3a616b69 Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Fri, 11 Oct 2013 17:59:47 +0000 Subject: [PATCH] [ELF] Add alias options for start-group/end-group options. There are aliases for --start-group/--end-group options represented by -( and -) respectively in the command line. This change adds and improves the test for the alias options to be tested. Looks like users use this option widely than explicitly using --start-group/--end-group. llvm-svn: 192470 --- lld/lib/Driver/GnuLdOptions.td | 4 ++++ lld/test/elf/X86_64/startGroupEndGroup.test | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lld/lib/Driver/GnuLdOptions.td b/lld/lib/Driver/GnuLdOptions.td index a8e5f52a7a22..0e9e43da85c6 100644 --- a/lld/lib/Driver/GnuLdOptions.td +++ b/lld/lib/Driver/GnuLdOptions.td @@ -158,9 +158,13 @@ defm u : smDash<"u", "undefined", def start_group : Flag<["--"], "start-group">, HelpText<"Start a group">, Group; +def alias_start_group: Flag<["-"], "(">, + Alias; def end_group : Flag<["--"], "end-group">, HelpText<"End a group">, Group; +def alias_end_group: Flag<["-"], ")">, + Alias; def as_needed : Flag<["--"], "as-needed">, HelpText<"This option affects ELF DT_NEEDED tags for " "dynamic libraries mentioned on the command line">, diff --git a/lld/test/elf/X86_64/startGroupEndGroup.test b/lld/test/elf/X86_64/startGroupEndGroup.test index ebf8b493434b..a3a2658f28de 100644 --- a/lld/test/elf/X86_64/startGroupEndGroup.test +++ b/lld/test/elf/X86_64/startGroupEndGroup.test @@ -17,8 +17,25 @@ RUN: %p/Inputs/group/fn1.o --end-group -o %t2 RUN: lld -flavor gnu -target x86_64 %p/Inputs/group/1.o --start-group \ RUN: --whole-archive %p/Inputs/group/libfn.a --no-whole-archive %p/Inputs/group/libfn1.a --end-group -o %t3 +# Test alias options too, as they are more widely used +# Test group +RUN: lld -flavor gnu -target x86_64 %p/Inputs/group/1.o -\( \ +RUN: %p/Inputs/group/libfn.a %p/Inputs/group/libfn1.a -\) -o %t1.alias + +# Mix object files in group +RUN: lld -flavor gnu -target x86_64 %p/Inputs/group/1.o -\( \ +RUN: %p/Inputs/group/fn.o %p/Inputs/group/fn2.o \ +RUN: %p/Inputs/group/fn1.o -\) -o %t2.alias + +# Mix Whole archive input, the group should not iterate the file libfn.a +RUN: lld -flavor gnu -target x86_64 %p/Inputs/group/1.o -\( \ +RUN: --whole-archive %p/Inputs/group/libfn.a --no-whole-archive %p/Inputs/group/libfn1.a -\) -o %t3.alias + RUN: llvm-nm %t1 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s RUN: llvm-nm %t2 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s RUN: llvm-nm %t3 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s +RUN: llvm-nm %t1.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s +RUN: llvm-nm %t2.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s +RUN: llvm-nm %t3.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s RESOLVEDEXTERNAL: {{[0-9a-z]+}} T fn2