While all symbols except for the ones in the version script are hidden,
the exported ones can still be overridden by other libraries which
export the same symbols. Using -fvisibility=protected fixes this. We can
only apply it to the shared library targets because of ld linker issues.
Bug b/
110884149
Change-Id: I98222420eabbb9ea0873816f52e1354625b9a3a8
Reviewed-on: https://swiftshader-review.googlesource.com/19688
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=${DIR}/${TARGET}.lds")
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_DEPENDS "${DIR}/${TARGET}.lds;")
+ # Don't allow symbols to be overridden by another module.
+ set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -fvisibility=protected")
+
# Both hash-style are needed, because we want both gold and
# GNU ld to be able to read our libraries.
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=both")