From 3d74987c815b0cfcced02ad8659c1cd33e7d35d5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 10 Sep 2019 22:43:34 -0700 Subject: [PATCH 1/4] compilers: Recognize Solaris 11.4 linker Solaris 11.3 & earlier sent the --version output to stderr, but Solaris 11.4 moved it to stdout in an attempt to be more compatible with the GNU tools, so look for it in both streams of output. Signed-off-by: Alan Coopersmith --- mesonbuild/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index b3885b6ed..e67e744ca 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -745,7 +745,7 @@ class Environment: else: i = 'GNU ld.bfd' linker = GnuDynamicLinker(compiler, for_machine, i, prefix, version=v) - elif 'Solaris' in e: + elif 'Solaris' in e or 'Solaris' in o: linker = SolarisDynamicLinker( compiler, for_machine, 'solaris', prefix, version=search_version(e)) From 692fade34e05e4f64b40e9f2c278719294079a63 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 29 Jun 2019 19:33:33 -0700 Subject: [PATCH 2/4] Fix "test cases/common/131 generated assembly" on Solaris Without this change, the test fails with: [11/12] Linking target square-gen-test. warning: Text relocation remains referenced against symbol offset in file square_unsigned 0x15 square-gen-test@exe/main.c.o [12/12] Linking target square-ct-test. warning: Text relocation remains referenced against symbol offset in file square_unsigned 0x15 square-ct-test@exe/main.c.o Signed-off-by: Alan Coopersmith --- test cases/common/131 generated assembly/square-x86_64.S.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test cases/common/131 generated assembly/square-x86_64.S.in b/test cases/common/131 generated assembly/square-x86_64.S.in index 856af137e..b2cf3ebe9 100644 --- a/test cases/common/131 generated assembly/square-x86_64.S.in +++ b/test cases/common/131 generated assembly/square-x86_64.S.in @@ -19,7 +19,7 @@ END .text .globl SYMBOL_NAME(square_unsigned) /* Only supported with GAS */ -# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) +# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) .type square_unsigned,@function # endif From 0faaf9720f65d53dc4f9e28f786cb8dee0b7046d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 8 Sep 2019 00:12:38 -0700 Subject: [PATCH 3/4] Fix "test cases/linuxlike/14 static dynamic linkage" on Solaris Solaris doesn't ship static libraries, so the test can't rely on libz.a existing on Solaris. Signed-off-by: Alan Coopersmith --- .../14 static dynamic linkage/meson.build | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/test cases/linuxlike/14 static dynamic linkage/meson.build b/test cases/linuxlike/14 static dynamic linkage/meson.build index a529f33ab..fb0e3537a 100644 --- a/test cases/linuxlike/14 static dynamic linkage/meson.build +++ b/test cases/linuxlike/14 static dynamic linkage/meson.build @@ -1,22 +1,36 @@ project('static dynamic', 'c') +# Solaris does not ship static libraries +if host_machine.system() == 'sunos' + has_static = false +else + has_static = true +endif cc = meson.get_compiler('c') z_default = cc.find_library('z') -z_static = cc.find_library('z', static: true) +if has_static + z_static = cc.find_library('z', static: true) +endif z_dynamic = cc.find_library('z', static: false) exe_default = executable('main_default', 'main.c', dependencies: [z_default]) -exe_static = executable('main_static', 'main.c', dependencies: [z_static]) +if has_static + exe_static = executable('main_static', 'main.c', dependencies: [z_static]) +endif exe_dynamic = executable('main_dynamic', 'main.c', dependencies: [z_dynamic]) test('test default', exe_default) -test('test static', exe_static) +if has_static + test('test static', exe_static) +endif test('test dynamic', exe_dynamic) -test('verify static linking', find_program('verify_static.py'), - args: ['--platform=' + host_machine.system(), exe_static.full_path()]) +if has_static + test('verify static linking', find_program('verify_static.py'), + args: ['--platform=' + host_machine.system(), exe_static.full_path()]) +endif test('verify dynamic linking', find_program('verify_static.py'), args: ['--platform=' + host_machine.system(), exe_dynamic.full_path()], should_fail: true) From 3e0279ba9f3a5b7e9cf4f37bc7329a5b9f5f95ed Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 8 Sep 2019 19:11:46 -0700 Subject: [PATCH 4/4] get_library_dirs: Add Solaris 64-bit library subdirs Solaris puts 32-bit libraries in the main /lib & /usr/lib directories and 64-bit libraries in platform specific subdirectories. Signed-off-by: Alan Coopersmith --- mesonbuild/mesonlib.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index d5646ed0f..03fbf0259 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -708,6 +708,14 @@ def get_library_dirs() -> typing.List[str]: else: plat = '' + # Solaris puts 32-bit libraries in the main /lib & /usr/lib directories + # and 64-bit libraries in platform specific subdirectories. + if is_sunos(): + if machine == 'i86pc': + plat = 'amd64' + elif machine.startswith('sun4'): + plat = 'sparcv9' + usr_platdir = Path('/usr/lib/') / plat if usr_platdir.is_dir(): unixdirs += [str(x) for x in (usr_platdir).iterdir() if x.is_dir()]