[lld] r246537 - COFF: .exe files should be able to export functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 02:15:58 PDT 2015


Author: ruiu
Date: Tue Sep  1 04:15:58 2015
New Revision: 246537

URL: http://llvm.org/viewvc/llvm-project?rev=246537&view=rev
Log:
COFF: .exe files should be able to export functions.

In r246424, I made a change that disables non-DLL to export
symbols. It turned out that the change was not correct. Both
DLLs and executables are able to export symbols (although the
latter is relatively rare). This change restores the feature.

Added:
    lld/trunk/test/COFF/export-exe.test
Modified:
    lld/trunk/COFF/Driver.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=246537&r1=246536&r2=246537&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Tue Sep  1 04:15:58 2015
@@ -634,7 +634,7 @@ void LinkerDriver::link(llvm::ArrayRef<c
 
   // Windows specific -- when we are creating a .dll file, we also
   // need to create a .lib file.
-  if (Config->DLL) {
+  if (!Config->Exports.empty() || Config->DLL) {
     fixupExports();
     writeImportLibrary();
     assignExportOrdinals();

Added: lld/trunk/test/COFF/export-exe.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/export-exe.test?rev=246537&view=auto
==============================================================================
--- lld/trunk/test/COFF/export-exe.test (added)
+++ lld/trunk/test/COFF/export-exe.test Tue Sep  1 04:15:58 2015
@@ -0,0 +1,10 @@
+# RUN: lld-link /entry:main /out:%t.exe /subsystem:windows \
+# RUN:   %p/Inputs/ret42.obj /export:main
+# RUN: llvm-objdump -p %t.exe | FileCheck %s
+
+CHECK:      Export Table:
+CHECK-NEXT: DLL name: export-exe.test.tmp.exe
+CHECK-NEXT: Ordinal base: 0
+CHECK-NEXT: Ordinal      RVA  Name
+CHECK-NEXT:       0        0
+CHECK-NEXT:       1   0x1000  main




More information about the llvm-commits mailing list