问题

/home/ffv/Downloads/tools/arm-2009q3/arm-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib/libc.so.6 section .tbss mismatches non-TLS reference in libz.a(gzio.o)

/home/ffv/Downloads/tools/arm-2009q3/arm-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib/libc.so.6: could not read symbols: Bad value

 

Thread-local storage (TLS)

TLS is a computer programming method that uses static or global memory local to a thread.

This is sometimes needed because normally all threads in a process share the same address space, which is sometimes undesirable. In other words, data in a static or global variable is normally always located at the same memory location, when referred to by threads from the same process. Variables on the call stack however are local to threads, because each thread has its own stack, residing in a different memory location.

Sometimes it is desirable that two threads referring to the same static or global variable are actually referring to different memory locations, thereby making the variable thread-local, a canonical example being the C error code variable errno.

If it is possible to make at least a memory address sized variable thread-local, it is in principle possible to make arbitrarily sized memory blocks thread-local, by allocating such a memory block and storing the memory address of that block in a thread-local variable.

 

解决方案

本项目中,部分变量errno(注意是errno, 不是error)这样声明:

extern int errno

但是多线程环境中errno并不一定都是int,改用:

#include <errno.h>

 

 posted on 2013-03-13 16:05  turtle_fly  阅读(1755)  评论(0编辑  收藏  举报