]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9919 - Mark infrequently used functions as cold rather than manually putting...
authorMike Hommey <mh@glandium.org>
Thu, 3 Feb 2022 23:48:06 +0000 (08:48 +0900)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 26 Sep 2022 16:36:28 +0000 (16:36 +0000)
libraries/liblmdb/mdb.c

index 6fc2abdf0a64e4331865ca54c93fe6ab4a8a47c6..fa01bb9bc5a6e7877d3f3b2dce80737a4f5beaba 100644 (file)
@@ -248,15 +248,21 @@ 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")))
+#if (((__clang_major__ << 8) | __clang_minor__) >= 0x0302) || (((__GNUC__ << 8) | __GNUC_MINOR__) >= 0x0403)
+/** Mark infrequently used env functions as cold. This puts them in a separate
+ *  section, and optimizes them for size */
+#define ESECT __attribute__ ((cold))
+#else
+/* On older compilers, use a separate section */
+# ifdef __GNUC__
+#  ifdef __APPLE__
+#   define      ESECT   __attribute__ ((section("__TEXT,text_env")))
+#  else
+#   define      ESECT   __attribute__ ((section("text_env")))
+#  endif
 # else
-#  define      ESECT   __attribute__ ((section("text_env")))
+#  define ESECT
 # endif
-#else
-#define ESECT
 #endif
 
 #ifdef _WIN32