From d6f40c33d3672bfb454d8669346186057df5da1f Mon Sep 17 00:00:00 2001 From: Niko Date: Mon, 29 Aug 2022 20:57:07 +0300 Subject: [PATCH] from mozilla/lmdb : Mark infrequently used functions as cold rather than manually putting them in a separate section (205300e) --- libraries/liblmdb/mdb.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index eb19c4e..8948397 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -251,13 +251,10 @@ union semun { # error "Two's complement, reasonably sized integer types, please" #endif -#ifdef __GNUC__ -/** Put infrequently used env functions in separate section */ -# ifdef __APPLE__ -# define ESECT __attribute__ ((section("__TEXT,text_env"))) -# else -# define ESECT __attribute__ ((section("text_env"))) -# endif +#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +/** Mark infrequently used env functions as cold. This puts them in a separate + * section, and optimizes them for size */ +#define ESECT __attribute__ ((cold)) #else #define ESECT #endif