From 48dccc68c63e4cabe18ebffc7c14d1a954de47dc Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 5 Aug 2025 18:44:47 +0100 Subject: [PATCH] tile.c: fix TiFree() non-inline symbol should always be emitted This is considered external public API for the tiles module, so while internal magic code might inline all call sites internally for performance the DSO (tclmagic.so) should always provide the API symbol even if it does not use it. This affects EL7 (gcc 4.8.5) and older: #define __GNUC_GNU_INLINE__ 1 This does not affect newer GCC from EL8 (gcc 8.5.0) and later has: #define __GNUC_STDC_INLINE__ 1 This can be seen as: ./Magic-8.3.536-x86_64-EL7.AppImage /tmp/.mount_Magic-FDdbKA/bin/wish: symbol lookup error: /tmp/.mount_Magic-FDdbKA/lib/magic/tcl/tclmagic.so: undefined symbol: TiFree This fixes the oversight introduced around commit f8ef715608 --- tiles/tile.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tiles/tile.c b/tiles/tile.c index fae08668..85938c44 100644 --- a/tiles/tile.c +++ b/tiles/tile.c @@ -769,6 +769,33 @@ extern inline void TiFree1(Tile **delay1, Tile *tile); extern inline void TiJoinX1(Tile **delay1, Tile *tile1, Tile *tile2, Plane *plane); extern inline void TiJoinY1(Tile **delay1, Tile *tile1, Tile *tile2, Plane *plane); #else +#ifdef HAVE_SYS_MMAN_H +void +TiFree(Tile *tile) +{ + tile->ti_client = PTR2CD(TileStoreFreeList); + TileStoreFreeList = tile; +} +#else +/* + * -------------------------------------------------------------------- + * + * TiFree --- + * + * Release memory allocation for tiles + * + * Results: + * None. + * + * -------------------------------------------------------------------- + */ +void +TiFree(Tile *tile) +{ + freeMagic((char *)tile); +} +#endif + /* To support older compilers (that don't auto emit based on -O level) */ void TiFreeIf(Tile *tile)