Commit 92b23022 authored by Alessandro Rubini's avatar Alessandro Rubini

check-error: new file, to catch undesired function calls

We don't want to call the real printf, which brings in the whole of
newlib, but it sometimes happen. So let's diagnose the problem
immediately rather than letting users wonder what is wrong with the
size.

Similarly, if building under ppsi, ensure we are not calling libgcc
division functions: any 64-bit division my be done with __div64_32
offered by ppsi/lib (copied from the kernel).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent f5ae81a7
...@@ -95,6 +95,8 @@ include sockitowm/sockitowm.mk ...@@ -95,6 +95,8 @@ include sockitowm/sockitowm.mk
include dev/dev.mk include dev/dev.mk
obj-y += check-error.o
CFLAGS = $(CFLAGS_PLATFORM) $(cflags-y) -Wall \ CFLAGS = $(CFLAGS_PLATFORM) $(cflags-y) -Wall \
-ffunction-sections -fdata-sections -Os \ -ffunction-sections -fdata-sections -Os \
-include include/trace.h -ggdb -include include/trace.h -ggdb
......
/*
* This file includes stuff we don't want to link, so if it is
* called in error we get a clear error message, rather than a
* "doesn't fit in ram" error
*/
#include <stdio.h>
extern void __you_should_not_call_printf_from_wrpc_sw(void);
extern void __you_should_not_divide_ll_in_wrpc_sw(void);
#undef printf /* Under ptp-noposix, this is #defined to mprintf */
int printf(const char *fmt, ...)
{
__you_should_not_call_printf_from_wrpc_sw();
return 0;
}
#ifdef CONFIG_PPSI /* with ppsi we can avoid libgcc code for division */
/* was used twice in picos_to_ts */
long long __moddi3 (long long A, long long B)
{
__you_should_not_divide_ll_in_wrpc_sw();
return 0;
}
/* was used in set_phase_shift, phase_to_cf_units */
long long __divdi3 (long long A, long long B)
{
__you_should_not_divide_ll_in_wrpc_sw();
return 0;
}
#endif /* config_ppsi */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment