Added "attribute internal" to __MACH__ platforms

Also, makefile does not add compiling options (LOCAL) to linker
flags (MYLDFLAGS).
This commit is contained in:
Roberto I 2025-10-18 10:30:12 -03:00
parent b352217b84
commit 26755cad99
2 changed files with 10 additions and 10 deletions

View File

@ -303,21 +303,21 @@ typedef unsigned long l_uint32;
** LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
** none of which to be exported to outside modules (LUAI_DDEF for
** definitions and LUAI_DDEC for declarations).
** Elf/gcc (versions 3.2 and later) mark them as "hidden" to optimize
** access when Lua is compiled as a shared library. Not all elf targets
** support this attribute. Unfortunately, gcc does not offer a way to
** check whether the target offers that support, and those without
** support give a warning about it. To avoid these warnings, change to
** the default definition.
** Elf and MACH/gcc (versions 3.2 and later) mark them as "hidden" to
** optimize access when Lua is compiled as a shared library. Not all elf
** targets support this attribute. Unfortunately, gcc does not offer
** a way to check whether the target offers that support, and those
** without support give a warning about it. To avoid these warnings,
** change to the default definition.
*/
#if !defined(LUAI_FUNC)
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__) /* { */
(defined(__ELF__) || defined(__MACH__))
#define LUAI_FUNC __attribute__((visibility("internal"))) extern
#else /* }{ */
#else
#define LUAI_FUNC extern
#endif /* } */
#endif
#define LUAI_DDEC(dec) LUAI_FUNC dec
#define LUAI_DDEF /* empty */

View File

@ -72,7 +72,7 @@ LOCAL = $(TESTS) $(CWARNS)
# For C89, "-std=c89 -DLUA_USE_C89"
# Note that Linux/Posix options are not compatible with C89
MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX
MYLDFLAGS= $(LOCAL) -Wl,-E
MYLDFLAGS= -Wl,-E
MYLIBS= -ldl