Commit c4972610 by Nicolas Capens Committed by Nicolas Capens

Protect 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 or the equivalent attribute fixes this. Protected visibility used to not work because of https://bugs.llvm.org//show_bug.cgi?id=30960, but that doesn't appear to be an issue any more. Bug chromium:852537 Bug swiftshader:64 Change-Id: Id0b1197b90baa5f5c68bf2aa107d12f8a9856796 Reviewed-on: https://swiftshader-review.googlesource.com/19728Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 6b21ba98
......@@ -33,7 +33,12 @@ config("swiftshader_libEGL_private_config") {
cflags += [ "-Wno-unused-but-set-variable" ]
}
defines += [ "EGLAPI=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))" ]
if (is_mac) {
cflags += [ "-fvisibility=protected" ]
defines += [ "EGLAPI=__attribute__((no_sanitize(\"function\")))" ]
} else {
defines += [ "EGLAPI=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ]
}
}
}
......
......@@ -48,9 +48,15 @@ config("swiftshader_libGLESv2_private_config") {
defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
"GL_APICALL=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))",
"GLAPI=GL_APICALL",
]
if (is_mac) {
cflags += [ "-fvisibility=protected" ]
defines += [ "GL_APICALL=__attribute__((no_sanitize(\"function\")))" ]
} else {
defines += [ "GL_APICALL=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ]
}
}
}
......
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