Skip to content

Commit

Permalink
CMake: Add support for exported symbols from xlc
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
  • Loading branch information
dnakamura committed Jul 10, 2019
1 parent d51a93b commit a56fcae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
23 changes: 20 additions & 3 deletions cmake/modules/platform/toolcfg/xlc.cmake
Expand Up @@ -168,7 +168,12 @@ elseif(OMR_OS_ZOS)

# Configure the platform dependent library for multithreading
set(OMR_PLATFORM_THREAD_LIBRARY "")
endif()

set(SPP_CMD ${CMAKE_C_COMPILER})
set(SPP_FLAGS -E -P)

if(OMR_OS_ZOS)
function(_omr_toolchain_process_exports TARGET_NAME)
# We only need to do something if we are dealing with a shared library
get_target_property(target_type ${TARGET_NAME} TYPE)
Expand All @@ -181,7 +186,19 @@ elseif(OMR_OS_ZOS)
-Wc,DLL,EXPORTALL
)
endfunction()
endif()
else()
function(_omr_toolchain_process_exports TARGET_NAME)
# we only need to do something if we are dealing with a shared library
get_target_property(target_type ${TARGET_NAME} TYPE)
if(NOT target_type STREQUAL "SHARED_LIBRARY")
return()
endif()

set(SPP_CMD ${CMAKE_C_COMPILER})
set(SPP_FLAGS -E -P)
set(exp_file "$<TARGET_PROPERTY:${TARGET_NAME},BINARY_DIR>/${TARGET_NAME}.exp")
omr_process_template(
"${omr_SOURCE_DIR}/cmake/modules/platform/toolcfg/xlc_exports.exp.in"
"${exp_file}"
)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-bE:${TARGET_NAME}.exp")
endfunction()
endif()
23 changes: 23 additions & 0 deletions cmake/modules/platform/toolcfg/xlc_exports.exp.in
@@ -0,0 +1,23 @@
*******************************************************************************
* Copyright (c) 2019, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at http://eclipse.org/legal/epl-2.0
* or the Apache License, Version 2.0 which accompanies this distribution
* and is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*****************************************************************************

$<JOIN:$<TARGET_PROPERTY:@TARGET_NAME@,EXPORTED_SYMBOLS>,
>

0 comments on commit a56fcae

Please sign in to comment.