Browse Source

ELF/Mach-O: Force default visibility for public API functions.

Thanks to Dymphna. #1409
Mike Pall 4 weeks ago
parent
commit
e17ee83326
2 changed files with 4 additions and 0 deletions
  1. 2 0
      src/jit/bcsave.lua
  2. 2 0
      src/luaconf.h

+ 2 - 0
src/jit/bcsave.lua

@@ -165,6 +165,8 @@ extern "C"
 #endif
 #ifdef _WIN32
 __declspec(dllexport)
+#elif (defined(__ELF__) || defined(__MACH__) || defined(__psp2__)) && !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
+__attribute__((visibility("default")))
 #endif
 const unsigned char %s%s[] = {
 ]], LJBC_PREFIX, ctx.modname))

+ 2 - 0
src/luaconf.h

@@ -132,6 +132,8 @@
 #else
 #define LUA_API		__declspec(dllimport)
 #endif
+#elif (defined(__ELF__) || defined(__MACH__) || defined(__psp2__)) && !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
+#define LUA_API		extern __attribute__((visibility("default")))
 #else
 #define LUA_API		extern
 #endif