summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-01-24 17:57:12 -0800
committerPádraig Brady <P@draigBrady.com>2016-01-24 18:09:08 -0800
commit6412d569dc104fe7c0dea8adf71c011df1afeaeb (patch)
tree1215def5527f6c4a3507a9e788c65738a135ca99
parentcfdac06196de4af636ddcfdbfb4c4fd22782d6e7 (diff)
downloadcoreutils-6412d569dc104fe7c0dea8adf71c011df1afeaeb.tar.xz
build: avoid dynamic linking issue on Solaris sparc
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
-rw-r--r--src/system.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/system.h b/src/system.h
index 9898bc79c..986a6c786 100644
--- a/src/system.h
+++ b/src/system.h
@@ -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"