[ELF] Copy IsPreemptible in replaceSymbol()

Otherwise, we may set IsPreemptible (e.g. --dynamic-list) then clear it
(in replaceCommonSymbols()).

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D62107

llvm-svn: 361122
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index 9e283ce..b2e6b7c 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -473,6 +473,7 @@
   Sym->ExportDynamic = Old.ExportDynamic;
   Sym->CanInline = Old.CanInline;
   Sym->Traced = Old.Traced;
+  Sym->IsPreemptible = Old.IsPreemptible;
   Sym->ScriptDefined = Old.ScriptDefined;
 
   // Print out a log message if --trace-symbol was specified.
diff --git a/lld/test/ELF/dynamic-list-preempt-replace-symbol.s b/lld/test/ELF/dynamic-list-preempt-replace-symbol.s
new file mode 100644
index 0000000..0407477
--- /dev/null
+++ b/lld/test/ELF/dynamic-list-preempt-replace-symbol.s
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: echo '{ common; };' > %t.list
+# RUN: ld.lld --dynamic-list %t.list -shared %t.o -o %t.so
+
+# RUN: llvm-readobj -r %t.so | FileCheck %s
+
+# CHECK: R_X86_64_GLOB_DAT common 0x0
+
+movq common@gotpcrel(%rip), %rax
+
+.type common,@object
+.comm common,4,4