浏览代码

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

Thanks to Dymphna. #1409
Mike Pall 1 月之前
父节点
当前提交
e17ee83326
共有 2 个文件被更改,包括 4 次插入0 次删除
  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
 #endif
 #ifdef _WIN32
 #ifdef _WIN32
 __declspec(dllexport)
 __declspec(dllexport)
+#elif (defined(__ELF__) || defined(__MACH__) || defined(__psp2__)) && !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
+__attribute__((visibility("default")))
 #endif
 #endif
 const unsigned char %s%s[] = {
 const unsigned char %s%s[] = {
 ]], LJBC_PREFIX, ctx.modname))
 ]], LJBC_PREFIX, ctx.modname))

+ 2 - 0
src/luaconf.h

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