summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/godot_linuxbsd.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-08 10:53:36 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-08 10:53:36 +0100
commit11964fb569a8c716120b240f067efd4a996b9ecb (patch)
treeb8b9cb71861fc97ce1c48f228674cb864618865f /platform/linuxbsd/godot_linuxbsd.cpp
parent261952a4c712e173994d596ef1161e97d812ffd3 (diff)
parent625c4bdacef4173f94200632362e25e537ad5d21 (diff)
downloadredot-engine-11964fb569a8c716120b240f067efd4a996b9ecb.tar.gz
Merge pull request #87464 from bruvzg/pck_section
[Linux] Add support for PCK embedding section with non GNU-ld linkers.
Diffstat (limited to 'platform/linuxbsd/godot_linuxbsd.cpp')
-rw-r--r--platform/linuxbsd/godot_linuxbsd.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/linuxbsd/godot_linuxbsd.cpp b/platform/linuxbsd/godot_linuxbsd.cpp
index efad9c8594..a2b6fbeb25 100644
--- a/platform/linuxbsd/godot_linuxbsd.cpp
+++ b/platform/linuxbsd/godot_linuxbsd.cpp
@@ -41,6 +41,18 @@
#include <sys/resource.h>
#endif
+// For export templates, add a section; the exporter will patch it to enclose
+// the data appended to the executable (bundled PCK).
+#if !defined(TOOLS_ENABLED) && defined(__GNUC__)
+static const char dummy[8] __attribute__((section("pck"), used)) = { 0 };
+
+// Dummy function to prevent LTO from discarding "pck" section.
+extern "C" const char *pck_section_dummy_call() __attribute__((used));
+extern "C" const char *pck_section_dummy_call() {
+ return &dummy[0];
+}
+#endif
+
int main(int argc, char *argv[]) {
#if defined(SANITIZERS_ENABLED)
// Note: Set stack size to be at least 30 MB (vs 8 MB default) to avoid overflow, address sanitizer can increase stack usage up to 3 times.