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 b67daab1e8
pkg/mpaland-printf: Add missing wrapper for fputs
Another endpoint that was forgotten to overwrite. This fixes the
output of the `i2c_scan` shell command that is e.g. included in the
test app in `tests/periph/i2c`.
2025-11-17 20:31:53 +01:00

37 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
LINKFLAGS += -Wl,-wrap=fputs
# 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