Hi Michael,

we are using asan with gcc for a c++ project. I also compiled the example in 
the wiki and that works as well.

The solution to the undefined reference is as obvious as it sounds, simple link 
the asan library. Normally it is linked by default, I guess. To compile a RIOT 
native example additional CFLAGS and LINKFLAGS are required.

```
CFLAGS +=  -fsanitize=address -O1 -fno-omit-frame-pointer -g
LINKFLAGS += -lasan
```
However, as soon as the program is started, a segfault occurs. Would be boring 
otherwise, right?

```
(gdb) bt
#0  0x0804d2ee in _native_syscall_enter () at 
/home/noir/RIOT/cpu/native/syscalls.c:102
#1  0x0804d711 in calloc (nmemb=1, size=20) at 
/home/noir/RIOT/cpu/native/syscalls.c:171
#2  0xf7ab4394 in ?? () from /lib32/libdl.so.2
#3  0xf7ab3e49 in dlsym () from /lib32/libdl.so.2
#4  0xf7b1eeea in ?? () from /usr/lib32/libasan.so.1
#5  0xf7af9475 in ?? () from /usr/lib32/libasan.so.1
#6  0xf7b0feb6 in __asan_init_v3 () from /usr/lib32/libasan.so.1
#7  0x0804a1d7 in _GLOBAL__sub_I_00099_1__native_rng_seed () at 
/home/noir/RIOT/cpu/native/startup.c:386
#8  0x0804ff2b in __libc_csu_init ()
#9  0xf79136b6 in __libc_start_main () from /lib32/libc.so.6
#10 0x08048ee1 in _start ()
```

Greetings
Raphael

> On Jun 19, 2015, at 11:37 AM, Michael Frey <f...@informatik.hu-berlin.de> 
> wrote:
> 
> Hi,
> 
> Am Di, 16.06.2015, 16:54, schrieb Hiesgen, Raphael:
> 
>> `__asan_xxxx” errors when compiling for native. Since I am not familiar
>> with the whole RIOT toolchain, are there any modifications that may
>> prevent linking to the standard libs?
> 
> just out of curiosity - have you tried to use address-sanitizer in gcc?
> 
> Best,
> Michael
> -- 
> Dipl.-Inf. (FH), M. Sc. Michael Frey
> Humboldt-Universität zu Berlin
> Department of Computer Science
> Rudower Chaussee 25
> 12489 Berlin, Germany
> 
> _______________________________________________
> devel mailing list
> devel@riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to