]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: avoid dynamic linking issue on Solaris sparc
authorPádraig Brady <P@draigBrady.com>
Mon, 25 Jan 2016 01:57:12 +0000 (17:57 -0800)
committerPádraig Brady <P@draigBrady.com>
Mon, 25 Jan 2016 02:09:08 +0000 (18:09 -0800)
Solaris Studio 12 on sparc (not x86) will not remove
unused functions, thus leaving a reference to an
undefined program_name symbol from emit_try_help().

* src/system.h (emit_try_help): Change from an inline function
to a macro, so that the inline function is not actually
defined in libstdbuf.c.
Fixes http://bugs.gnu.org/22430

src/system.h

index 9898bc79c483cf1c3f300fac47ad96b9211fe01a..986a6c7869ebb02edef814b2abfb6c6b0586fa04 100644 (file)
@@ -650,11 +650,17 @@ emit_ancillary_info (char const *program)
           node, node == program ? " invocation" : "");
 }
 
-static inline void
-emit_try_help (void)
-{
-  fprintf (stderr, _("Try '%s --help' for more information.\n"), program_name);
-}
+/* Use a macro rather than an inline function, as this references
+   the global program_name, which causes dynamic linking issues
+   in libstdbuf.so on some systems where unused functions
+   are not removed by the linker.  */
+#define emit_try_help() \
+  do \
+    { \
+      fprintf (stderr, _("Try '%s --help' for more information.\n"), \
+               program_name); \
+    } \
+  while (0)
 
 #include "inttostr.h"