Fixing the Linux build without breaking the Mac build
This change adds 2 platform specific files for Linux, which
are used to define the typeinfo() functions used in some
classes in order to satisfy the ubsan compiler on Linux.
Unfortunately, adding those definitions on all platforms
breaks the build on Mac. Those aren't necessary on Windows,
so the Linux specific files are enough to make the build
work properly on all platforms.
Change-Id: If731ab2e5df47731695412da04f9b2db576ea140
Reviewed-on: https://swiftshader-review.googlesource.com/8768
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libEGL/BUILD.gn b/src/OpenGL/libEGL/BUILD.gn
index 6442bca..c4fc7df 100644
--- a/src/OpenGL/libEGL/BUILD.gn
+++ b/src/OpenGL/libEGL/BUILD.gn
@@ -69,7 +69,10 @@
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) {
- sources += [ "../../Main/libX11.cpp" ]
+ sources += [
+ "../../Main/libX11.cpp",
+ "TypeInfo.cpp",
+ ]
ldflags =
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
}
diff --git a/src/OpenGL/libEGL/TypeInfo.cpp b/src/OpenGL/libEGL/TypeInfo.cpp
new file mode 100644
index 0000000..0b4b97e
--- /dev/null
+++ b/src/OpenGL/libEGL/TypeInfo.cpp
@@ -0,0 +1,28 @@
+// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "common/Image.hpp"
+#include "Main/FrameBuffer.hpp"
+#include "Renderer/Surface.hpp"
+
+namespace sw
+{
+void FrameBuffer::typeinfo() {}
+void Surface::typeinfo() {}
+}
+
+namespace egl
+{
+void Image::typeinfo() {}
+}
diff --git a/src/OpenGL/libGLESv2/BUILD.gn b/src/OpenGL/libGLESv2/BUILD.gn
index 8b0024a..3862e8b 100644
--- a/src/OpenGL/libGLESv2/BUILD.gn
+++ b/src/OpenGL/libGLESv2/BUILD.gn
@@ -89,6 +89,7 @@
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) {
+ sources += [ "TypeInfo.cpp" ]
ldflags =
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
}
diff --git a/src/OpenGL/libGLESv2/TypeInfo.cpp b/src/OpenGL/libGLESv2/TypeInfo.cpp
new file mode 100644
index 0000000..8fb91d3
--- /dev/null
+++ b/src/OpenGL/libGLESv2/TypeInfo.cpp
@@ -0,0 +1,22 @@
+// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "libEGL/Display.h"
+#include "libEGL/EGLSurface.h"
+
+namespace egl
+{
+void Surface::typeinfo() {}
+void Display::typeinfo() {}
+}