[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
This commit is contained in:
Shankar Easwaran 2013-10-11 17:59:47 +00:00
parent 5480365b25
commit 11202deb4a
2 changed files with 21 additions and 0 deletions

View File

@ -158,9 +158,13 @@ defm u : smDash<"u", "undefined",
def start_group : Flag<["--"], "start-group">,
HelpText<"Start a group">,
Group<grp_resolveropt>;
def alias_start_group: Flag<["-"], "(">,
Alias<start_group>;
def end_group : Flag<["--"], "end-group">,
HelpText<"End a group">,
Group<grp_resolveropt>;
def alias_end_group: Flag<["-"], ")">,
Alias<end_group>;
def as_needed : Flag<["--"], "as-needed">,
HelpText<"This option affects ELF DT_NEEDED tags for "
"dynamic libraries mentioned on the command line">,

View File

@ -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