Vendor import of lld release_50 branch r311219:

https://llvm.org/svn/llvm-project/lld/branches/release_50@311219
This commit is contained in:
Dimitry Andric 2017-08-20 21:03:55 +00:00
parent 9e3ca9b3ba
commit f1f34882c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/lld/dist/; revision=322734
svn path=/vendor/lld/lld-release_50-r311606/; revision=322844; tag=vendor/lld/lld-release_50-r311606
6 changed files with 35 additions and 7 deletions

View File

@ -458,8 +458,8 @@ static void createImportLibrary(bool AsLib) {
std::vector<COFFShortExport> Exports;
for (Export &E1 : Config->Exports) {
COFFShortExport E2;
// Use SymbolName, which will have any stdcall or fastcall qualifiers.
E2.Name = E1.SymbolName;
E2.Name = E1.Name;
E2.SymbolName = E1.SymbolName;
E2.ExtName = E1.ExtName;
E2.Ordinal = E1.Ordinal;
E2.Noname = E1.Noname;
@ -470,7 +470,7 @@ static void createImportLibrary(bool AsLib) {
}
writeImportLibrary(getImportName(AsLib), getImplibPath(), Exports,
Config->Machine);
Config->Machine, false);
}
static void parseModuleDefs(StringRef Path) {

View File

@ -638,7 +638,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->Fini = Args.getLastArgValue(OPT_fini, "_fini");
Config->GcSections = getArg(Args, OPT_gc_sections, OPT_no_gc_sections, false);
Config->GdbIndex = Args.hasArg(OPT_gdb_index);
Config->ICF = Args.hasArg(OPT_icf);
Config->ICF = getArg(Args, OPT_icf_all, OPT_icf_none, false);
Config->Init = Args.getLastArgValue(OPT_init, "_init");
Config->LTOAAPipeline = Args.getLastArgValue(OPT_lto_aa_pipeline);
Config->LTONewPmPasses = Args.getLastArgValue(OPT_lto_newpm_passes);

View File

@ -126,7 +126,9 @@ def hash_style: S<"hash-style">,
def help: F<"help">, HelpText<"Print option help">;
def icf: F<"icf=all">, HelpText<"Enable identical code folding">;
def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">;
def icf_none: F<"icf=none">, HelpText<"Disable identical code folding">;
def image_base : J<"image-base=">, HelpText<"Set the base address">;

View File

@ -2,7 +2,8 @@
# RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj
# RUN: echo -e "LIBRARY foo\nEXPORTS\n stdcall" > %t.def
# RUN: lld-link -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
# RUN: llvm-nm %t.lib | FileCheck %s
# RUN: llvm-readobj %t.lib | FileCheck %s
# CHECK: Name type: undecorate
# CHECK: __imp__stdcall@8
# CHECK: _stdcall@8

View File

@ -39,8 +39,9 @@ CHECK3-NEXT: 4 0
CHECK3-NEXT: 5 0x1008
CHECK3-NEXT: 6 0x1010 exportfn2
# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2
# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 /implib:%t.lib
# RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=CHECK4 %s
# RUN: llvm-nm %t.lib | FileCheck -check-prefix=CHECK4-NM %s
CHECK4: Export Table:
CHECK4: DLL name: export.test.tmp.dll
@ -49,6 +50,8 @@ CHECK4-NEXT: 0 0
CHECK4-NEXT: 1 0x1010 exportfn3
CHECK4-NEXT: 2 0x1008 f1
CHECK4-NEXT: 3 0x1010 f2
CHECK4-NM: 00000000 T f1
CHECK4-NM: 00000000 T f2
# RUN: echo "EXPORTS exportfn1 @3" > %t.def
# RUN: echo "fn2=exportfn2 @2" >> %t.def

22
test/ELF/icf-none.s Normal file
View File

@ -0,0 +1,22 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2 --icf=all --icf=none --verbose | FileCheck %s
# CHECK-NOT: selected .text.f1
.globl _start, f1, f2
_start:
ret
.section .text.f1, "ax"
f1:
mov $60, %rax
mov $42, %rdi
syscall
.section .text.f2, "ax"
f2:
mov $60, %rax
mov $42, %rdi
syscall