[NSWI004] memset missing reference

Vojtech Horky horky at d3s.mff.cuni.cz
Tue Oct 13 14:35:47 CEST 2020


Hello.

Dne 13. 10. 20 v 14:23 Jura Pelc napsal(a):
> I've got the following error in the pipeline, but on local and nswi004 
> suite_a01_base.txt passed.
> 
> [2020-10-13 12:05:20,617 K/printk/uint DEBUG] [make] src/lib/print.o: In 
> function `print_hex':
> [2020-10-13 12:05:20,617 K/printk/uint DEBUG] [make] (.text+0xac): 
> undefined reference to `memset'
> [2020-10-13 12:05:20,617 K/printk/uint DEBUG] [make] src/lib/print.o: In 
> function `print_int':
> [2020-10-13 12:05:20,617 K/printk/uint DEBUG] [make] (.text+0x178): 
> undefined reference to `memset'
> 
> But I do not use `memset` directly in code. Only think is static array 
> allocation
> 
> chartext[] = { 0, 0, 0, 0 ...
> 
> Has anyone any clue what is wrong here?

Compiler may insert calls to memset() by itself if it needs to zero-out 
a large chunk of memory.

Since you do not have memset() (as you do not have anything from 
standard library), you can either try to somehow bypass the static 
initialization or provide your own memset (see runtime.c for 
software-provided integer operands as an example of what functions GCC 
could also assume to exist).

As an anecdote: in some versions of GCC your own implementation of 
memset could be prone to this "optimization" too and in the end it 
called itself recursively :-)

Cheers,
- VH

> 
> 
> -- 
> 
> S pozdravem Jiří Pelc
> Matematicko-fyzikální fakulta
> Univerzita Karlova
> 
> _______________________________________________
> NSWI004 mailing list
> NSWI004 at d3s.mff.cuni.cz
> https://d3s.mff.cuni.cz/mailman/listinfo/nswi004
> 


More information about the NSWI004 mailing list