Commit e3621dca by Nicolas Capens Committed by Nicolas Capens

Build with -Bsymbolic to prevent symbol preemption

The CMake build was already using -fvisibility=protected, which has the same effect but uses duplicate symbol entries for internal/external use. Bug: b/148240133 Change-Id: I8069a1b293a6ec0604be32179ed591ffaa645ed7 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41648 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent da659b37
...@@ -293,8 +293,9 @@ macro(set_shared_library_export_map TARGET DIR) ...@@ -293,8 +293,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. # -Bsymbolic binds symbol references to their global definitions within
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -fvisibility=protected") # a shared object, thereby preventing symbol preemption.
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wl,-Bsymbolic")
if(ARCH STREQUAL "mipsel" OR ARCH STREQUAL "mips64el") if(ARCH STREQUAL "mipsel" OR ARCH STREQUAL "mips64el")
# MIPS supports sysv hash-style only. # MIPS supports sysv hash-style only.
......
...@@ -555,6 +555,12 @@ cc_defaults { ...@@ -555,6 +555,12 @@ cc_defaults {
"-Wno-non-virtual-dtor", "-Wno-non-virtual-dtor",
], ],
ldflags: [
// -Bsymbolic binds symbol references to their global definitions within
// a shared object, thereby preventing symbol preemption.
"-Wl,-Bsymbolic",
],
local_include_dirs: [ "Vulkan" ], local_include_dirs: [ "Vulkan" ],
version_script: "Vulkan/android_vk_swiftshader.lds", version_script: "Vulkan/android_vk_swiftshader.lds",
......
...@@ -158,8 +158,12 @@ swiftshader_shared_library("swiftshader_libvulkan") { ...@@ -158,8 +158,12 @@ swiftshader_shared_library("swiftshader_libvulkan") {
inputs = [ inputs = [
"vk_swiftshader.lds", "vk_swiftshader.lds",
] ]
ldflags = [ "-Wl,--version-script=" + ldflags = [
rebase_path("vk_swiftshader.lds", root_build_dir) ] # -Bsymbolic binds symbol references to their global definitions within
# a shared object, thereby preventing symbol preemption.
"-Wl,-Bsymbolic",
"-Wl,--version-script=" +
rebase_path("vk_swiftshader.lds", root_build_dir) ]
} }
deps = [ deps = [
......
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