[libc-commits] [libc] [libc] Add program_invocation(_short)_name and tweak err.h functions (PR #212448)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Mon Aug 3 06:04:33 PDT 2026
================
@@ -23,21 +23,21 @@
#include "src/__support/printf_core/printf_main.h"
#include "src/__support/printf_core/writer.h"
-#ifdef __linux__
+#ifdef LIBC_FULL_BUILD
+#include "src/errno/program_invocation_short_name.h"
+#define PROGRAM_INVOCATION_SHORT_NAME \
+ LIBC_NAMESPACE::program_invocation_short_name
+#else
extern "C" char *program_invocation_short_name;
+#define PROGRAM_INVOCATION_SHORT_NAME ::program_invocation_short_name
#endif
namespace LIBC_NAMESPACE_DECL {
namespace err_reporting {
void report(bool show_err, int err_num, const char *fmt,
internal::ArgList &args) {
- const char *progname = "libllvmlibc";
- // TODO: Use a proper way to get progname if available.
-#ifdef __linux__
- progname = program_invocation_short_name;
-#endif
-
+ const char *progname = PROGRAM_INVOCATION_SHORT_NAME;
----------------
kaladron wrote:
Thanks. I was thinking more about this, and this isn't a Linux-specific chunk, so we can't count on baremetal not returning null, etc.
https://github.com/llvm/llvm-project/pull/212448
More information about the libc-commits
mailing list