OSDN Git Service

Prevent LTO from eliminating cross-library virtual methods.
authorNicolas Capens <capn@google.com>
Thu, 11 May 2017 15:25:00 +0000 (11:25 -0400)
committerNicolas Capens <capn@google.com>
Thu, 11 May 2017 17:51:48 +0000 (17:51 +0000)
commit9ed48bae7a2ff600712a0b8672f2b7d5f33b453b
treef5edd7e2194a0f35801d8084fd1bedb3a4dfb000
parentf34d1ace76a7e384685ebc5395141295cf1c618f
Prevent LTO from eliminating cross-library virtual methods.

libEGL has to call virtual methods on objects created withing libGLESv2,
and vice-versa. Clang's aggressive link-time-optimization considers
calls to these methods unreachable, because they're not defined within
the same linkage unit. So when they do get called, we're hitting UD
instructions. It can be fixed by marking these classes with
[[clang::lto_visibility_public]] attributes:
https://clang.llvm.org/docs/LTOVisibility.html

Bug chromium:720933

Change-Id: I87f9b09921a1b2d443121efcdb5525ff4cb5797b
Reviewed-on: https://swiftshader-review.googlesource.com/9688
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
20 files changed:
src/Common/BUILD.gn
src/Main/BUILD.gn
src/Main/FrameBuffer.hpp
src/OpenGL/common/BUILD.gn
src/OpenGL/common/Image.hpp
src/OpenGL/common/Object.hpp
src/OpenGL/compiler/BUILD.gn
src/OpenGL/compiler/Compiler.vcxproj
src/OpenGL/libEGL/BUILD.gn
src/OpenGL/libEGL/Context.hpp
src/OpenGL/libEGL/Display.h
src/OpenGL/libEGL/EGLSurface.h
src/OpenGL/libEGL/libEGL.vcxproj
src/OpenGL/libGLESv2/BUILD.gn
src/OpenGL/libGLESv2/Context.h
src/OpenGL/libGLESv2/libGLESv2.vcxproj
src/Renderer/BUILD.gn
src/Renderer/Surface.hpp
src/Shader/BUILD.gn
src/SwiftShader/SwiftShader.vcxproj