]> granicus.if.org Git - sudo/commitdiff
When checking for weak aliases, check the gcc attribute format last
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Mar 2015 19:44:48 +0000 (12:44 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Mar 2015 19:44:48 +0000 (12:44 -0700)
since some C compilers just ignore unsupported attributes.

m4/ax_sys_weak_alias.m4

index e1bfd336590ca2e2c4bc22cedfb031dd820d8bb2..4da60eed7e77a734d153da7de5e178dff6f52b2b 100644 (file)
 #   checked in turn, and the first one found is prefered. Note that only one
 #   of the mentioned preprocessor macros will be defined!
 #
-#   1. Function attributes
-#
-#   This scheme was first introduced by the GNU C compiler, and attaches
-#   attributes to particular functions. It is among the easiest to use, and
-#   so is the first one checked. If this scheme is detected, the
-#   preprocessor macro HAVE_SYS_WEAK_ALIAS_ATTRIBUTE will be defined to 1.
-#   This scheme is used as in the following code fragment:
-#
-#     void __weakf(int c)
-#     {
-#       /* Function definition... */
-#     }
-#
-#     void weakf(int c) __attribute__((weak, alias("__weakf")));
-#
-#   2. #pragma weak
+#   1. #pragma weak
 #
 #   This scheme is in use by many compilers other than the GNU C compiler.
 #   It is also particularly easy to use, and fairly portable -- well, as
@@ -55,7 +40,7 @@
 #       /* Function definition... */
 #     }
 #
-#   3. #pragma _HP_SECONDARY_DEF
+#   2. #pragma _HP_SECONDARY_DEF
 #
 #   This scheme appears to be in use by the HP compiler. As it is rather
 #   specialized, this is one of the last schemes checked. If it is the first
@@ -70,7 +55,7 @@
 #       /* Function definition... */
 #     }
 #
-#   4. #pragma _CRI duplicate
+#   3. #pragma _CRI duplicate
 #
 #   This scheme appears to be in use by the Cray compiler. As it is rather
 #   specialized, it too is one of the last schemes checked. If it is the
 #       /* Function definition... */
 #     }
 #
+#   4. Function attributes
+#
+#   This scheme was first introduced by the GNU C compiler, and attaches
+#   attributes to particular functions. However, since some compilers
+#   simply ignore unsupported attributes, this scheme is tried last.
+#   If this scheme is detected, the preprocessor macro
+#   HAVE_SYS_WEAK_ALIAS_ATTRIBUTE will be defined to 1.
+#   This scheme is used as in the following code fragment:
+#
+#     void __weakf(int c)
+#     {
+#       /* Function definition... */
+#     }
+#
+#     void weakf(int c) __attribute__((weak, alias("__weakf")));
+#
 #   In addition to the preprocessor macros listed above, if any scheme is
 #   found, the preprocessor macro HAVE_SYS_WEAK_ALIAS will also be defined
 #   to 1.
@@ -118,10 +119,10 @@ AC_DEFUN([AX_SYS_WEAK_ALIAS], [
   ax_sys_weak_alias=no
 
   # Figure out what kind of aliasing may be supported...
-  _AX_SYS_WEAK_ALIAS_ATTRIBUTE
   _AX_SYS_WEAK_ALIAS_PRAGMA
   _AX_SYS_WEAK_ALIAS_HPSECONDARY
   _AX_SYS_WEAK_ALIAS_CRIDUPLICATE
+  _AX_SYS_WEAK_ALIAS_ATTRIBUTE
 
   # Do we actually support aliasing?
   AC_CACHE_CHECK([how to create weak aliases with $CC],