[cfe-dev] Export symbols for dll with clang/mingw on win
Kim
soldoutseashell at gmail.com
Sun May 19 12:24:10 PDT 2013
Hi guys, just trying to do a simple dll build using clang. The same code
compiles using mingw gcc with a simple invocation like: g++ -shared -o
test.dll test.cpp
Here are my arguments and the verbose output. I'm getting some undefined
symbol errors.
-------------------------------------------------------------------------------------------
C:\Program Files (x86)\LLVM\mingwbuild\bin>clang++ -std=c++11 -shared -v
-o test.dll test.cpp -I "C:\MinGW\include\sys" -I
"C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include" -I "C:\MinGW\include"
-I "C:\MinGW\include\c++" -I "C:\MinGW\include\c++\4.8.0" -I
"C:\MinGW\include\c++\4.8.0\backward" -I
"C:\MinGW\include\c++\4.8.0\bits" -I "C:\MinGW\include\c++\4.8.0\debug"
-I "C:\MinGW\include\c++\4.8.0\decimal" -I
"C:\MinGW\include\c++\4.8.0\ext" -I
"C:\MinGW\include\c++\4.8.0\i686-pc-mingw32" -I
"C:\MinGW\include\c++\4.8.0\tr1" -I "C:\MinGW\include\c++\4.8.0\tr2" -I
"C:\MinGW\include\c++\4.8.0\profile" -Wl,--verbose
clang version 3.3 (trunk)
Target: i686-pc-mingw32
Thread model: posix
"C:/Program Files (x86)/LLVM/mingwbuild/bin/clang++.exe" -cc1 -triple
i686-pc-mingw32 -S -disable-free -main-file-name test.cpp
-mrelocation-model static -mdisable-fp-elim -fmath-errno
-mconstructor-aliases -target-cpu pentium4 -v -resource-dir "C:/Program
Files (x86)/LLVM/mingwbuild/bin\\..\\lib\\clang\\3.3" -I
"C:\\MinGW\\include\\sys" -I
"C:\\MinGW\\lib\\gcc\\i686-pc-mingw32\\4.8.0\\include" -I
"C:\\MinGW\\include" -I "C:\\MinGW\\include\\c++" -I
"C:\\MinGW\\include\\c++\\4.8.0" -I
"C:\\MinGW\\include\\c++\\4.8.0\\backward" -I
"C:\\MinGW\\include\\c++\\4.8.0\\bits" -I
"C:\\MinGW\\include\\c++\\4.8.0\\debug" -I
"C:\\MinGW\\include\\c++\\4.8.0\\decimal" -I
"C:\\MinGW\\include\\c++\\4.8.0\\ext" -I
"C:\\MinGW\\include\\c++\\4.8.0\\i686-pc-mingw32" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr1" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr2" -I
"C:\\MinGW\\include\\c++\\4.8.0\\profile" -std=c++11 -fdeprecated-macro
-fno-dwarf-directory-asm -ferror-limit 19 -fmessage-length 150
-mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option
-vectorize-loops -o C:/Users/Kim/AppData/Local/Temp/test-694880.s -x c++
test.cpp
clang -cc1 version 3.3 based upon LLVM 3.3svn default target i686-pc-mingw32
#include "..." search starts here:
#include <...> search starts here:
C:\MinGW\include\sys
C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include
C:\MinGW\include
C:\MinGW\include\c++
C:\MinGW\include\c++\4.8.0
C:\MinGW\include\c++\4.8.0\backward
C:\MinGW\include\c++\4.8.0\bits
C:\MinGW\include\c++\4.8.0\debug
C:\MinGW\include\c++\4.8.0\decimal
C:\MinGW\include\c++\4.8.0\ext
C:\MinGW\include\c++\4.8.0\i686-pc-mingw32
C:\MinGW\include\c++\4.8.0\tr1
C:\MinGW\include\c++\4.8.0\tr2
C:\MinGW\include\c++\4.8.0\profile
C:/Program Files (x86)/LLVM/mingwbuild/bin/../lib/clang/3.3/include
C:/Program Files
(x86)/LLVM/mingwbuild/bin/../lib/clang/3.3/../../../include
/mingw/include
c:/mingw/include
End of search list.
"C:/MinGW/bin/g++.exe" -std=c++11 -shared -v -I
"C:\\MinGW\\include\\sys" -I
"C:\\MinGW\\lib\\gcc\\i686-pc-mingw32\\4.8.0\\include" -I
"C:\\MinGW\\include" -I "C:\\MinGW\\include\\c++" -I
"C:\\MinGW\\include\\c++\\4.8.0" -I
"C:\\MinGW\\include\\c++\\4.8.0\\backward" -I
"C:\\MinGW\\include\\c++\\4.8.0\\bits" -I
"C:\\MinGW\\include\\c++\\4.8.0\\debug" -I
"C:\\MinGW\\include\\c++\\4.8.0\\decimal" -I
"C:\\MinGW\\include\\c++\\4.8.0\\ext" -I
"C:\\MinGW\\include\\c++\\4.8.0\\i686-pc-mingw32" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr1" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr2" -I
"C:\\MinGW\\include\\c++\\4.8.0\\profile" -c -m32 -o
C:/Users/Kim/AppData/Local/Temp/test-694881.o -x assembler
C:/Users/Kim/AppData/Local/Temp/test-694880.s
Using built-in specs.
COLLECT_GCC=C:/MinGW/bin/g++.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest
--with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr
--with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686
--with-tune=generic --disable-libstdcxx-pch --disable-nls
--disable-shared --disable-sjlj-exceptions --disable-win32-registry
--enable-checking=release --enable-lto
Thread model: win32
gcc version 4.8.0 (GCC)
COLLECT_GCC_OPTIONS='-std=c++11' '-shared' '-v' '-I'
'C:\MinGW\include\sys' '-I'
'C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include' '-I' 'C:\MinGW\include'
'-I' 'C:\MinGW\include\c++' '-I' 'C:\MinGW\include\c++\4.8.0' '-I'
'C:\MinGW\include\c++\4.8.0\backward' '-I'
'C:\MinGW\include\c++\4.8.0\bits' '-I'
'C:\MinGW\include\c++\4.8.0\debug' '-I'
'C:\MinGW\include\c++\4.8.0\decimal' '-I'
'C:\MinGW\include\c++\4.8.0\ext' '-I'
'C:\MinGW\include\c++\4.8.0\i686-pc-mingw32' '-I'
'C:\MinGW\include\c++\4.8.0\tr1' '-I' 'C:\MinGW\include\c++\4.8.0\tr2'
'-I' 'C:\MinGW\include\c++\4.8.0\profile' '-c' '-m32' '-o'
'C:/Users/Kim/AppData/Local/Temp/test-694881.o' '-mtune=generic'
'-march=i686'
as -v -I C:\MinGW\include\sys -I
C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include -I C:\MinGW\include -I
C:\MinGW\include\c++ -I C:\MinGW\include\c++\4.8.0 -I
C:\MinGW\include\c++\4.8.0\backward -I C:\MinGW\include\c++\4.8.0\bits
-I C:\MinGW\include\c++\4.8.0\debug -I
C:\MinGW\include\c++\4.8.0\decimal -I C:\MinGW\include\c++\4.8.0\ext -I
C:\MinGW\include\c++\4.8.0\i686-pc-mingw32 -I
C:\MinGW\include\c++\4.8.0\tr1 -I C:\MinGW\include\c++\4.8.0\tr2 -I
C:\MinGW\include\c++\4.8.0\profile -o
C:/Users/Kim/AppData/Local/Temp/test-694881.o
C:/Users/Kim/AppData/Local/Temp/test-694880.s
GNU assembler version 2.23.2 (i686-pc-mingw32) using BFD version (GNU
Binutils) 2.23.2
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.8.0/;c:/mingw/bin/../libexec/gcc/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../;/mingw/lib/
COLLECT_GCC_OPTIONS='-std=c++11' '-shared' '-v' '-I'
'C:\MinGW\include\sys' '-I'
'C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include' '-I' 'C:\MinGW\include'
'-I' 'C:\MinGW\include\c++' '-I' 'C:\MinGW\include\c++\4.8.0' '-I'
'C:\MinGW\include\c++\4.8.0\backward' '-I'
'C:\MinGW\include\c++\4.8.0\bits' '-I'
'C:\MinGW\include\c++\4.8.0\debug' '-I'
'C:\MinGW\include\c++\4.8.0\decimal' '-I'
'C:\MinGW\include\c++\4.8.0\ext' '-I'
'C:\MinGW\include\c++\4.8.0\i686-pc-mingw32' '-I'
'C:\MinGW\include\c++\4.8.0\tr1' '-I' 'C:\MinGW\include\c++\4.8.0\tr2'
'-I' 'C:\MinGW\include\c++\4.8.0\profile' '-c' '-m32' '-o'
'C:/Users/Kim/AppData/Local/Temp/test-694881.o' '-mtune=generic'
'-march=i686'
"C:/MinGW/bin/g++.exe" -std=c++11 -shared -v -I
"C:\\MinGW\\include\\sys" -I
"C:\\MinGW\\lib\\gcc\\i686-pc-mingw32\\4.8.0\\include" -I
"C:\\MinGW\\include" -I "C:\\MinGW\\include\\c++" -I
"C:\\MinGW\\include\\c++\\4.8.0" -I
"C:\\MinGW\\include\\c++\\4.8.0\\backward" -I
"C:\\MinGW\\include\\c++\\4.8.0\\bits" -I
"C:\\MinGW\\include\\c++\\4.8.0\\debug" -I
"C:\\MinGW\\include\\c++\\4.8.0\\decimal" -I
"C:\\MinGW\\include\\c++\\4.8.0\\ext" -I
"C:\\MinGW\\include\\c++\\4.8.0\\i686-pc-mingw32" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr1" -I
"C:\\MinGW\\include\\c++\\4.8.0\\tr2" -I
"C:\\MinGW\\include\\c++\\4.8.0\\profile" -m32 -o test.o
C:/Users/Kim/AppData/Local/Temp/test-694881.o -Wl,--verbose
Using built-in specs.
COLLECT_GCC=C:/MinGW/bin/g++.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.8.0/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest
--with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr
--with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686
--with-tune=generic --disable-libstdcxx-pch --disable-nls
--disable-shared --disable-sjlj-exceptions --disable-win32-registry
--enable-checking=release --enable-lto
Thread model: win32
gcc version 4.8.0 (GCC)
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.8.0/;c:/mingw/bin/../libexec/gcc/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../;/mingw/lib/
COLLECT_GCC_OPTIONS='-std=c++11' '-shared' '-v' '-I'
'C:\MinGW\include\sys' '-I'
'C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include' '-I' 'C:\MinGW\include'
'-I' 'C:\MinGW\include\c++' '-I' 'C:\MinGW\include\c++\4.8.0' '-I'
'C:\MinGW\include\c++\4.8.0\backward' '-I'
'C:\MinGW\include\c++\4.8.0\bits' '-I'
'C:\MinGW\include\c++\4.8.0\debug' '-I'
'C:\MinGW\include\c++\4.8.0\decimal' '-I'
'C:\MinGW\include\c++\4.8.0\ext' '-I'
'C:\MinGW\include\c++\4.8.0\i686-pc-mingw32' '-I'
'C:\MinGW\include\c++\4.8.0\tr1' '-I' 'C:\MinGW\include\c++\4.8.0\tr2'
'-I' 'C:\MinGW\include\c++\4.8.0\profile' '-m32' '-o' 'test.o'
'-mtune=generic' '-march=i686'
c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.8.0/collect2.exe
--shared -Bdynamic -e _DllMainCRTStartup at 12 --enable-auto-image-base -o
test.o c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../dllcrt2.o
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtbegin.o
-Lc:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0
-Lc:/mingw/bin/../lib/gcc
-Lc:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../.. -L/mingw/lib
C:/Users/Kim/AppData/Local/Temp/test-694881.o --verbose -lstdc++
-lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32
-luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtend.o
GNU ld (GNU Binutils) 2.23.2
Supported emulations:
i386pe
using internal linker script:
==================================================
/* Default linker script, for normal executables */
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR("/c/temp/gcc/dest/i686-pc-mingw32/lib");
SEARCH_DIR("/c/temp/gcc/dest/lib"); SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SECTIONS
{
/* Make the virtual address and file offset synced if the alignment is
lower than the target page size. */
. = SIZEOF_HEADERS;
. = ALIGN(__section_alignment__);
.text __image_base__ + ( __section_alignment__ < 0x1000 ? . :
__section_alignment__ ) :
{
*(.init)
*(.text)
*(SORT(.text$*))
*(.text.*)
*(.gnu.linkonce.t.*)
*(.glue_7t)
*(.glue_7)
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0);
*(.fini)
/* ??? Why is .gcc_exc here? */
*(.gcc_exc)
PROVIDE (etext = .);
*(.gcc_except_table)
}
/* The Cygwin32 library uses a section to avoid copying certain data
on fork. This used to be named ".data". The linker used
to include this between __data_start__ and __data_end__, but that
breaks building the cygwin32 dll. Instead, we name the section
".data_cygwin_nocopy" and explicitly include it after __data_end__. */
.data BLOCK(__section_alignment__) :
{
__data_start__ = . ;
*(.data)
*(.data2)
*(SORT(.data$*))
*(.jcr)
__data_end__ = . ;
*(.data_cygwin_nocopy)
}
.rdata BLOCK(__section_alignment__) :
{
*(.rdata)
*(SORT(.rdata$*))
__rt_psrelocs_start = .;
*(.rdata_runtime_pseudo_reloc)
__rt_psrelocs_end = .;
}
__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
.eh_frame BLOCK(__section_alignment__) :
{
*(.eh_frame*)
}
.pdata BLOCK(__section_alignment__) :
{
*(.pdata)
}
.bss BLOCK(__section_alignment__) :
{
__bss_start__ = . ;
*(.bss)
*(COMMON)
__bss_end__ = . ;
}
.edata BLOCK(__section_alignment__) :
{
*(.edata)
}
/DISCARD/ :
{
*(.debug$S)
*(.debug$T)
*(.debug$F)
*(.drectve)
*(.note.GNU-stack)
*(.gnu.lto_*)
}
.idata BLOCK(__section_alignment__) :
{
/* This cannot currently be handled with grouped sections.
See pe.em:sort_sections. */
SORT(*)(.idata$2)
SORT(*)(.idata$3)
/* These zeroes mark the end of the import list. */
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
SORT(*)(.idata$4)
__IAT_start__ = .;
SORT(*)(.idata$5)
__IAT_end__ = .;
SORT(*)(.idata$6)
SORT(*)(.idata$7)
}
.CRT BLOCK(__section_alignment__) :
{
___crt_xc_start__ = . ;
*(SORT(.CRT$XC*)) /* C initialization */
___crt_xc_end__ = . ;
___crt_xi_start__ = . ;
*(SORT(.CRT$XI*)) /* C++ initialization */
___crt_xi_end__ = . ;
___crt_xl_start__ = . ;
*(SORT(.CRT$XL*)) /* TLS callbacks */
/* ___crt_xl_end__ is defined in the TLS Directory support code */
___crt_xp_start__ = . ;
*(SORT(.CRT$XP*)) /* Pre-termination */
___crt_xp_end__ = . ;
___crt_xt_start__ = . ;
*(SORT(.CRT$XT*)) /* Termination */
___crt_xt_end__ = . ;
}
.tls BLOCK(__section_alignment__) :
{
___tls_start__ = . ;
*(.tls)
*(.tls$)
*(SORT(.tls$*))
___tls_end__ = . ;
}
.endjunk BLOCK(__section_alignment__) :
{
/* end is deprecated, don't use it */
PROVIDE (end = .);
PROVIDE ( _end = .);
__end__ = .;
}
.rsrc BLOCK(__section_alignment__) :
{
*(.rsrc)
*(SORT(.rsrc$*))
}
.reloc BLOCK(__section_alignment__) :
{
*(.reloc)
}
.stab BLOCK(__section_alignment__) (NOLOAD) :
{
*(.stab)
}
.stabstr BLOCK(__section_alignment__) (NOLOAD) :
{
*(.stabstr)
}
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section. Unlike other targets that fake this by putting the
section VMA at 0, the PE format will not allow it. */
/* DWARF 1.1 and DWARF 2. */
.debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_aranges)
}
.debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_pubnames)
}
.debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_pubtypes)
}
/* DWARF 2. */
.debug_info BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_info .gnu.linkonce.wi.*)
}
.debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_abbrev)
}
.debug_line BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_line)
}
.debug_frame BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_frame*)
}
.debug_str BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_str)
}
.debug_loc BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_loc)
}
.debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_macinfo)
}
/* SGI/MIPS DWARF 2 extensions. */
.debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_weaknames)
}
.debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_funcnames)
}
.debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_typenames)
}
.debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_varnames)
}
.debug_macro BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_macro)
}
/* DWARF 3. */
.debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_ranges)
}
/* DWARF 4. */
.debug_types BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_types .gnu.linkonce.wt.*)
}
}
==================================================
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../dllcrt2.o succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../dllcrt2.o
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtbegin.o
succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtbegin.o
attempt to open C:/Users/Kim/AppData/Local/Temp/test-694881.o succeeded
C:/Users/Kim/AppData/Local/Temp/test-694881.o
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libstdc++.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingw32.a
succeeded
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/libgcc.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmoldname.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingwex.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmsvcrt.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libadvapi32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libshell32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libuser32.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libkernel32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingw32.a
succeeded
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/libgcc.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmoldname.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmsvcrt.a succeeded
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtend.o
succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtend.o
Cannot export _CreateScript: symbol not found
Cannot export _GetName: symbol not found
Cannot export _GetType: symbol not found
GNU ld (GNU Binutils) 2.23.2
Supported emulations:
i386pe
using internal linker script:
==================================================
/* Default linker script, for normal executables */
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR("/c/temp/gcc/dest/i686-pc-mingw32/lib");
SEARCH_DIR("/c/temp/gcc/dest/lib"); SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SECTIONS
{
/* Make the virtual address and file offset synced if the alignment is
lower than the target page size. */
. = SIZEOF_HEADERS;
. = ALIGN(__section_alignment__);
.text __image_base__ + ( __section_alignment__ < 0x1000 ? . :
__section_alignment__ ) :
{
*(.init)
*(.text)
*(SORT(.text$*))
*(.text.*)
*(.gnu.linkonce.t.*)
*(.glue_7t)
*(.glue_7)
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0);
*(.fini)
/* ??? Why is .gcc_exc here? */
*(.gcc_exc)
PROVIDE (etext = .);
*(.gcc_except_table)
}
/* The Cygwin32 library uses a section to avoid copying certain data
on fork. This used to be named ".data". The linker used
to include this between __data_start__ and __data_end__, but that
breaks building the cygwin32 dll. Instead, we name the section
".data_cygwin_nocopy" and explicitly include it after __data_end__. */
.data BLOCK(__section_alignment__) :
{
__data_start__ = . ;
*(.data)
*(.data2)
*(SORT(.data$*))
*(.jcr)
__data_end__ = . ;
*(.data_cygwin_nocopy)
}
.rdata BLOCK(__section_alignment__) :
{
*(.rdata)
*(SORT(.rdata$*))
__rt_psrelocs_start = .;
*(.rdata_runtime_pseudo_reloc)
__rt_psrelocs_end = .;
}
__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
.eh_frame BLOCK(__section_alignment__) :
{
*(.eh_frame*)
}
.pdata BLOCK(__section_alignment__) :
{
*(.pdata)
}
.bss BLOCK(__section_alignment__) :
{
__bss_start__ = . ;
*(.bss)
*(COMMON)
__bss_end__ = . ;
}
.edata BLOCK(__section_alignment__) :
{
*(.edata)
}
/DISCARD/ :
{
*(.debug$S)
*(.debug$T)
*(.debug$F)
*(.drectve)
*(.note.GNU-stack)
*(.gnu.lto_*)
}
.idata BLOCK(__section_alignment__) :
{
/* This cannot currently be handled with grouped sections.
See pe.em:sort_sections. */
SORT(*)(.idata$2)
SORT(*)(.idata$3)
/* These zeroes mark the end of the import list. */
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
SORT(*)(.idata$4)
__IAT_start__ = .;
SORT(*)(.idata$5)
__IAT_end__ = .;
SORT(*)(.idata$6)
SORT(*)(.idata$7)
}
.CRT BLOCK(__section_alignment__) :
{
___crt_xc_start__ = . ;
*(SORT(.CRT$XC*)) /* C initialization */
___crt_xc_end__ = . ;
___crt_xi_start__ = . ;
*(SORT(.CRT$XI*)) /* C++ initialization */
___crt_xi_end__ = . ;
___crt_xl_start__ = . ;
*(SORT(.CRT$XL*)) /* TLS callbacks */
/* ___crt_xl_end__ is defined in the TLS Directory support code */
___crt_xp_start__ = . ;
*(SORT(.CRT$XP*)) /* Pre-termination */
___crt_xp_end__ = . ;
___crt_xt_start__ = . ;
*(SORT(.CRT$XT*)) /* Termination */
___crt_xt_end__ = . ;
}
.tls BLOCK(__section_alignment__) :
{
___tls_start__ = . ;
*(.tls)
*(.tls$)
*(SORT(.tls$*))
___tls_end__ = . ;
}
.endjunk BLOCK(__section_alignment__) :
{
/* end is deprecated, don't use it */
PROVIDE (end = .);
PROVIDE ( _end = .);
__end__ = .;
}
.rsrc BLOCK(__section_alignment__) :
{
*(.rsrc)
*(SORT(.rsrc$*))
}
.reloc BLOCK(__section_alignment__) :
{
*(.reloc)
}
.stab BLOCK(__section_alignment__) (NOLOAD) :
{
*(.stab)
}
.stabstr BLOCK(__section_alignment__) (NOLOAD) :
{
*(.stabstr)
}
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section. Unlike other targets that fake this by putting the
section VMA at 0, the PE format will not allow it. */
/* DWARF 1.1 and DWARF 2. */
.debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_aranges)
}
.debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_pubnames)
}
.debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_pubtypes)
}
/* DWARF 2. */
.debug_info BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_info .gnu.linkonce.wi.*)
}
.debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_abbrev)
}
.debug_line BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_line)
}
.debug_frame BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_frame*)
}
.debug_str BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_str)
}
.debug_loc BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_loc)
}
.debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_macinfo)
}
/* SGI/MIPS DWARF 2 extensions. */
.debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_weaknames)
}
.debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_funcnames)
}
.debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_typenames)
}
.debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_varnames)
}
.debug_macro BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_macro)
}
/* DWARF 3. */
.debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_ranges)
}
/* DWARF 4. */
.debug_types BLOCK(__section_alignment__) (NOLOAD) :
{
*(.debug_types .gnu.linkonce.wt.*)
}
}
==================================================
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../dllcrt2.o succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../dllcrt2.o
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtbegin.o
succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtbegin.o
attempt to open C:/Users/Kim/AppData/Local/Temp/test-694881.o succeeded
C:/Users/Kim/AppData/Local/Temp/test-694881.o
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libstdc++.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingw32.a
succeeded
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/libgcc.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmoldname.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingwex.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmsvcrt.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libadvapi32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libshell32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libuser32.a succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libkernel32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmingw32.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmoldname.a
succeeded
attempt to open
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/../../../libmsvcrt.a succeeded
attempt to open c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtend.o
succeeded
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.8.0/crtend.o
Cannot export _Create: symbol not found
collect2.exe: error: ld returned 1 exit status
clang++.exe: error: linker (via gcc) command failed with exit code 1
(use -v to see invocation)
C:\Program Files (x86)\LLVM\mingwbuild\bin>
-------------------------------------------------------------------------------------
The dll code is just a few simple export test function:
extern "C"
{
__declspec (dllexport) void Create()
{
return;
}
}
If I call llvm-nm.exe with a generated test.o file I get the following
so I'm not sure what the problem is.
00000050 T _Create
Can anyone tell me how to get this linking correctly please?
Thanks a lot.
More information about the cfe-dev
mailing list