1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
--- configure
+++ configure
@@ -7087,11 +7087,11 @@
# Define system-specific variables.
case $host_os in
aix*)
symcode='[BCDT]'
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32* | cegcc* | winnt*)
symcode='[ABCDGISTW]'
;;
hpux*)
if test ia64 = "$host_cpu"; then
symcode='[ABCDEGRST]'
@@ -7126,46 +7126,56 @@
symcode='[ABCDGIRSTW]' ;;
esac
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Gets list of data symbols to import.
- lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+ lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/\1/p'"
# Adjust the below global symbol transforms to fixup imported variables.
- lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
- lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
+ lt_cdecl_hook=" -e 's/^I .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/extern __declspec(dllimport) char \1;/p'"
+ lt_c_name_hook=" -e 's/^I .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) 0},/p'"
lt_c_name_lib_hook="\
- -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\
- -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'"
+ -e 's/^I .* \(lib[a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) 0},/p'\
+ -e 's/^I .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"lib\1\", (void *) 0},/p'"
else
# Disable hooks by default.
lt_cv_sys_global_symbol_to_import=
lt_cdecl_hook=
lt_c_name_hook=
lt_c_name_lib_hook=
+ case $host_os in
+ winnt*)
+ lt_cv_sys_global_symbol_to_import="sed -n -e 's/^D [^ ]* \([a-zA-Z_][0-9a-zA-Z_]*\)$/\1/p'"
+ lt_cdecl_hook=" -e 's/^D [^ ]* \([a-zA-Z_][0-9a-zA-Z_]*\)$/extern __declspec(dllimport) char \1;/p'"
+ lt_c_name_hook=" -e 's/^D [^ ]* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) 0},/p'"
+ lt_c_name_lib_hook="\
+ -e 's/^D [^ ]* \(lib[a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) 0},/p'\
+ -e 's/^D [^ ]* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"lib\1\", (void *) 0},/p'"
+ ;;
+ esac
fi
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="sed -n"\
$lt_cdecl_hook\
-" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
-" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
+" -e 's/^T .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
$lt_c_name_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
-" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
+" -e 's/^$symcode$symcode* .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) \&\1},/p'"
# Transform an extracted symbol line into symbol name with lib prefix and
# symbol address.
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
$lt_c_name_lib_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
-" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
-" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'"
+" -e 's/^$symcode$symcode* .* \(lib[a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \([a-zA-Z_][0-9a-zA-Z_]*\)$/ {\"lib\1\", (void *) \&\1},/p'"
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
@@ -7175,35 +7185,43 @@
# Try without a prefix underscore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
- symxfrm="\\1 $ac_symprfx\\2 \\2"
+ # In Windows import libraries, symbols may be prefixed with __imp_, as well
+ # as __nm_ when using GNU ld. The leading underscore (in 32bit) comes after
+ # the __imp_ and __nm_ prefix, so make sure to strip the underscore from the
+ # symbol name instead of the __imp_ or __nm_ prefix, leaving these prefixes
+ # intact in the symbol pipe output.
+ symxfrm="\\1 \\2$ac_symprfx\\3 \\2\\3"
# Write the raw and C identifiers.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function,
# D for any global variable and I for any imported variable.
# Also find C++ and __fastcall symbols from MSVC++,
- # which start with @ or ?.
+ # which start with @ or ?. And Cygwin gawk-4.1.4-3 and newer
+ # treats input as binary, have to drop carriage return first.
lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {sub(/\\r\$/,\"\")};"\
" {last_section=section; section=\$ 3};"\
" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
" {if(hide[section]) next};"\
" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+" \$ 0~/ [0-9a-fA-F]*[1-9a-fA-F][0-9a-fA-F]* UNDEF /{f=\"C\"};"\
" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx"
else
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\(__imp_\|__nm_\)\{0,1\}$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
|