Skip to content

Commit 8766886

Browse files
authored
Merge pull request #5577 from mattip/attrib-hidden
add visibility=default to exported functions, visibility=hidden to most assembler
2 parents 0ddb20f + 15a1484 commit 8766886

153 files changed

Lines changed: 1181 additions & 786 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ if(NOT NO_CBLAS)
733733
message (STATUS "Generating cblas.h in ${CMAKE_INSTALL_INCLUDEDIR}")
734734
set(CBLAS_H ${CMAKE_BINARY_DIR}/generated/cblas.h)
735735
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/cblas.h CBLAS_H_CONTENTS)
736-
string(REPLACE "common" "openblas_config" CBLAS_H_CONTENTS_NEW "${CBLAS_H_CONTENTS}")
736+
string(REPLACE "common" "openblas_config" CBLAS_H_CONTENTS_NEW2 "${CBLAS_H_CONTENTS}")
737+
string(REPLACE "OPENBLAS_EXPORT " "" CBLAS_H_CONTENTS_NEW "${CBLAS_H_CONTENTS_NEW2}")
737738

738739
# Symbol prefix/suffix settings rename exported functions, not C typedefs.
739740
# Protect callback type names from the textual function-name rewriting below.

Makefile.install

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ ifdef SYMBOLSUFFIX
9191
@sed 's/\(openblas_complex_\)\([^ ]*\)$(SYMBOLSUFFIX)/\1\2 /g' cblas.tmp > cblas.tmp2
9292
@sed 's/goto[^() ]*/&$(SYMBOLSUFFIX)/g' cblas.tmp2 > cblas.tmp
9393
endif
94+
95+
@sed 's/OPENBLAS_EXPORT //' cblas.tmp > cblas.tmp2
96+
@sed 's/common/openblas_config/g' cblas.tmp2 > cblas.tmp
97+
9498
@sed -e 's/OPENBLAS_DOJOB_CALLBACK_TYPE/openblas_dojob_callback/g' \
9599
-e 's/OPENBLAS_THREADS_CALLBACK_TYPE/openblas_threads_callback/g' \
96100
-e 's/OPENBLAS_XERBLA_HANDLER_TYPE/openblas_xerbla_handler/g' \
97101
-e 's/common/openblas_config/g' \
98102
cblas.tmp > "$(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/cblas.h"
103+
99104
endif
100105

101106
ifneq ($(OSNAME), AIX)

Makefile.system

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,13 @@ ifeq ($(F_COMPILER), GFORTRAN)
604604
ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB))
605605
EXPRECISION = 1
606606
CCOMMON_OPT += -DEXPRECISION -m128bit-long-double
607+
CCOMMON_OPT += -fvisibility=hidden
607608
FCOMMON_OPT += -m128bit-long-double
608609
endif
609610
ifeq ($(C_COMPILER), CLANG)
610611
EXPRECISION = 1
611612
CCOMMON_OPT += -DEXPRECISION
613+
CCOMMON_OPT += -fvisibility=hidden
612614
FCOMMON_OPT += -m128bit-long-double
613615
endif
614616
endif
@@ -627,11 +629,13 @@ ifeq ($(F_COMPILER), GFORTRAN)
627629
ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB))
628630
EXPRECISION = 1
629631
CCOMMON_OPT += -DEXPRECISION -m128bit-long-double
632+
CCOMMON_OPT += -fvisibility=hidden
630633
FCOMMON_OPT += -m128bit-long-double
631634
endif
632635
ifeq ($(C_COMPILER), CLANG)
633636
EXPRECISION = 1
634637
CCOMMON_OPT += -DEXPRECISION
638+
CCOMMON_OPT += -fvisibility=hidden
635639
FCOMMON_OPT += -m128bit-long-double
636640
endif
637641
endif

cblas.h

Lines changed: 258 additions & 258 deletions
Large diffs are not rendered by default.

cmake/lapacke.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,4 +2550,4 @@ endforeach ()
25502550

25512551
set(lapacke_include_dir "${NETLIB_LAPACK_DIR}/LAPACKE/include")
25522552
include_directories(${lapacke_include_dir})
2553-
set_source_files_properties(${LAPACKE_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_CFLAGS}")
2553+
set_source_files_properties(${LAPACKE_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_CFLAGS} -fvisibility=default")

cmake/system.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ if (BUILD_HFLOAT16)
743743
endif()
744744
if(NOT MSVC)
745745
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CCOMMON_OPT}")
746+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
746747
endif()
747748
# TODO: not sure what PFLAGS is -hpa
748749
set(PFLAGS "${PFLAGS} ${CCOMMON_OPT} -I${TOPDIR} -DPROFILE ${COMMON_PROF}")
@@ -805,6 +806,7 @@ if (${CMAKE_C_COMPILER_ID} MATCHES "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL
805806
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DNOCHANGE")
806807
endif ()
807808

809+
string(REPLACE "-fvisibility=hidden" "" LAPACK_CFLAGS ${LAPACK_CFLAGS})
808810

809811
if (NOT DEFINED SUFFIX)
810812
set(SUFFIX o)

common.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ extern "C" {
5757
#define __USE_SVID
5858
#endif
5959

60+
#include "exports.h"
6061
#ifdef BUILD_KERNEL
6162
#include "config_kernel.h"
6263
#else
@@ -209,8 +210,10 @@ extern "C" {
209210

210211
#ifdef NEEDBUNDERSCORE
211212
#define BLASFUNC(FUNC) FUNC##_
213+
#define OPENBLAS_API(FUNC) OPENBLAS_EXPORT FUNC##_
212214
#else
213215
#define BLASFUNC(FUNC) FUNC
216+
#define OPENBLAS_API(FUNC) OPENBLAS_EXPORT FUNC
214217
#endif
215218

216219
#undef USE_PTHREAD_LOCK
@@ -761,13 +764,13 @@ int get_num_proc (int);
761764
int get_node_equal (void);
762765
#endif
763766

764-
void goto_set_num_threads(int);
767+
OPENBLAS_EXPORT void goto_set_num_threads(int);
765768

766769
/* Cooperative cancellation of in-flight operations
767770
* (implemented in driver/others/openblas_cancel.c). These symbols are
768771
* exported without SYMBOLPREFIX/SYMBOLSUFFIX decoration. */
769772
size_t *openblas_cancel_token(void);
770-
void openblas_cancel(size_t *token, size_t loaded_token);
773+
OPENBLAS_EXPORT void openblas_cancel(size_t *token, size_t loaded_token);
771774

772775
/* Internal helpers for the instrumented compute drivers. */
773776
size_t openblas_cancel_begin(void);
@@ -905,7 +908,7 @@ typedef void (*openblas_xerbla_handler)(const char *name,
905908
const blasint *info,
906909
size_t name_length);
907910
#endif
908-
openblas_xerbla_handler openblas_set_xerbla(openblas_xerbla_handler handler);
911+
OPENBLAS_EXPORT openblas_xerbla_handler openblas_set_xerbla(openblas_xerbla_handler handler);
909912
#ifdef __cplusplus
910913
}
911914
#endif

0 commit comments

Comments
 (0)