Commit 517a57f4 by Nicolas Capens Committed by Nicolas Capens

Fix protecting exported symbols from overrides.

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/19688Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 5e1520fa
...@@ -110,6 +110,9 @@ macro(set_shared_library_export_map TARGET DIR) ...@@ -110,6 +110,9 @@ macro(set_shared_library_export_map TARGET DIR)
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=${DIR}/${TARGET}.lds") 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;") 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 # Both hash-style are needed, because we want both gold and
# GNU ld to be able to read our libraries. # GNU ld to be able to read our libraries.
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=both") set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=both")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment