Skip to content

Commit 7b97581

Browse files
committed
Configuration: make Solaris builds with gcc recognise GNU ld
The solaris config targets assumed that GNU cc used Sun ld at all times. However, there are setups where GNU ld is used instead, so we adapt the Solaris gcc config targets to use the mechanism introduced with Configurations/shared_info.pl to try to detect what ld flavor is being used and set the diverse ld flags accordingly. Fixes openssl#8547 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from openssl#8548)
1 parent 287e1a7 commit 7b97581

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

Configurations/10-main.conf

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,28 @@ my %targets = (
211211
ex_libs => add("-lsocket -lnsl -ldl"),
212212
dso_scheme => "dlfcn",
213213
thread_scheme => "pthreads",
214+
},
215+
#### Solaris common with Sun C setups
216+
"solaris-common-cc" => {
217+
inherit_from => [ "solaris-common" ],
218+
template => 1,
214219
shared_target => "solaris",
215220
shared_ldflag => "-Wl,-Bsymbolic",
216221
shared_defflag => "-Wl,-M,",
217222
shared_sonameflag=> "-Wl,-h,",
218223
},
224+
#### Solaris common with GNU C setups
225+
"solaris-common-gcc" => {
226+
inherit_from => [ "solaris-common" ],
227+
template => 1,
228+
shared_target => "solaris-gcc", # The rest is on shared_info.pl
229+
},
219230
#### Solaris x86 with GNU C setups
220231
"solaris-x86-gcc" => {
221232
# NB. GNU C has to be configured to use GNU assembler, and not
222233
# /usr/ccs/bin/as. Failure to comply will result in compile
223234
# failures [at least] in 32-bit build.
224-
inherit_from => [ "solaris-common" ],
235+
inherit_from => [ "solaris-common-gcc" ],
225236
CC => "gcc",
226237
CFLAGS => add_before(picker(default => "-Wall",
227238
debug => "-O0 -g",
@@ -244,7 +255,7 @@ my %targets = (
244255
# code [thanks to inline assembler], I would actually recommend
245256
# to consider using gcc shared build even with vendor compiler:-)
246257
# -- <appro@openssl.org>
247-
inherit_from => [ "solaris-common" ],
258+
inherit_from => [ "solaris-common-gcc" ],
248259
CC => "gcc",
249260
CFLAGS => add_before(picker(default => "-Wall",
250261
debug => "-O0 -g",
@@ -274,7 +285,7 @@ my %targets = (
274285
# Consider switching to solaris64-x86_64-gcc even here...
275286
#
276287
"solaris64-x86_64-cc" => {
277-
inherit_from => [ "solaris-common" ],
288+
inherit_from => [ "solaris-common-cc" ],
278289
CC => "cc",
279290
CFLAGS => add_before(picker(debug => "-g",
280291
release => "-xO5 -xdepend -xbuiltin")),
@@ -294,7 +305,7 @@ my %targets = (
294305

295306
#### SPARC Solaris with GNU C setups
296307
"solaris-sparcv7-gcc" => {
297-
inherit_from => [ "solaris-common" ],
308+
inherit_from => [ "solaris-common-gcc" ],
298309
CC => "gcc",
299310
CFLAGS => add_before(picker(default => "-Wall",
300311
debug => "-O0 -g",
@@ -332,7 +343,7 @@ my %targets = (
332343
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
333344
# SC5.0 note: Compiler common patch 107357-01 or later is required!
334345
"solaris-sparcv7-cc" => {
335-
inherit_from => [ "solaris-common" ],
346+
inherit_from => [ "solaris-common-cc" ],
336347
CC => "cc",
337348
CFLAGS => add_before(picker(debug => "-g",
338349
release => "-xO5 -xdepend")),

Configurations/shared-info.pl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,16 @@ sub detect_gnu_cc {
8484
shared_sonameflag => '-h ',
8585
};
8686
},
87+
'solaris-gcc-shared' => sub {
88+
return $shared_info{'linux-shared'} if detect_gnu_ld();
89+
return {
90+
# Note: we should also have -shared here, but because some
91+
# config targets define it with an added -static-libgcc
92+
# following it, we don't want to change the order. This
93+
# forces all solaris gcc config targets to define shared_ldflag
94+
shared_ldflag => '-Wl,-Bsymbolic',
95+
shared_defflag => "-Wl,-M,",
96+
shared_sonameflag => "-Wl,-h,",
97+
};
98+
},
8799
);

0 commit comments

Comments
 (0)