1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00
RIOT/pkg/mpaland-printf/Makefile.include
Marian Buschsieweke 69c6627725
pkg/mpaland-printf: wrap putc() and fputc()
Those two functions have previously been overlooked. This commit adds
the missing wrappers.
2025-10-29 18:14:26 +01:00

36 lines
1.3 KiB
Makefile

# wrap stdio functions to use mpaland's printf instead of the one from the
# standard C lib
LINKFLAGS += -Wl,-wrap=printf
LINKFLAGS += -Wl,-wrap=fprintf
LINKFLAGS += -Wl,-wrap=dprintf
LINKFLAGS += -Wl,-wrap=sprintf
LINKFLAGS += -Wl,-wrap=snprintf
LINKFLAGS += -Wl,-wrap=vprintf
LINKFLAGS += -Wl,-wrap=vfprintf
LINKFLAGS += -Wl,-wrap=vdprintf
LINKFLAGS += -Wl,-wrap=vsprintf
LINKFLAGS += -Wl,-wrap=vsnprintf
LINKFLAGS += -Wl,-wrap=putchar
LINKFLAGS += -Wl,-wrap=putc
LINKFLAGS += -Wl,-wrap=fputc
LINKFLAGS += -Wl,-wrap=puts
# By wrapping the newlib only `_printf_common` symbol to the undefined
# `__wrap__printf_common` symbol, linking will fail if any reference to
# `_printf_common` remains. Since `_printf_common` is only used by newlib's
# stdio, we will catch any instance of both mpaland-printf and newlib's stdio
# being both linked in.
LINKFLAGS += -Wl,-wrap=_printf_common
LINKFLAGS += -Wl,-wrap=_fprintf_r
LINKFLAGS += -Wl,-wrap=_printf_r
LINKFLAGS += -Wl,-wrap=iprintf
LINKFLAGS += -Wl,-wrap=fiprintf
# Workaround for bug in the newlib headers shipped with e.g. Ubuntu 24.04 LTS
# not defining PRId64 / PRIu64 / PRIx64 / PRIo64 in <inttypes.h> due to an issue
# in <machine/_default_types.h>. Tested to cause no regression on fixed newlib
# headers.
ifneq (,$(filter newlib,$(FEATURES_USED)))
CFLAGS += -D__int64_t_defined=1
endif