From 836447663e6f109907fe381664a8b2d05c2c934f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Jul 2009 08:36:11 -0400 Subject: BUG: Parse implicit link editor -z*extract options The Sun Fortran compiler passes -zallextract and -zdefaultextract to the linker so that all objects from one of its archives are included in the link. This teaches the implicit options parser to recognize the flags. We need to pass them explicitly on C++ link lines when Fortran code is linked. --- Modules/CMakeParseImplicitLinkInfo.cmake | 5 ++++- Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index b56781f..6ea3d58 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -25,7 +25,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var) list(GET args 0 cmd) endif() if("${cmd}" MATCHES "${linker_regex}") - string(REGEX REPLACE ";-([LY]);" ";-\\1" args "${args}") + string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}") foreach(arg IN LISTS args) if("${arg}" MATCHES "^-L(.:)?[/\\]") # Unix search path. @@ -46,6 +46,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var) elseif("${arg}" MATCHES "^-l:") # HP named library. list(APPEND implicit_libs ${arg}) + elseif("${arg}" MATCHES "^-z(all|default|weak)extract") + # Link editor option. + list(APPEND implicit_libs ${arg}) endif() endforeach() break() diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index c0934c8..2d5d975 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -58,13 +58,13 @@ list(APPEND platforms sun_CC) # f77 dummy.f -v set(sun_f77_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -lf77compat -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o") -set(sun_f77_libs "f77compat;ompstubs;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") +set(sun_f77_libs "f77compat;-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") set(sun_f77_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_f77) # f90 dummy.f -v set(sun_f90_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o") -set(sun_f90_libs "ompstubs;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") +set(sun_f90_libs "-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") set(sun_f90_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_f90) -- cgit v0.12