On Sun, Jul 18, 2010 at 8:34 PM, Liu Xin <navy.x...@gmail.com> wrote:
> Hi Android Developers, > > This is a question of dynalic linker. where is the variables in shared > library? > let's conside errno in libc. is it in .sbss of libc.so? or it will be in > .bss in the executable? > > errno is a very special case in every C library, because it has to be thread-specific. In both Bionic and GLibc, errno is a macro define as: #define errno *__errno_location() where "__errno_location()" is a function that returns the address of a thread-specific error condition variable. It is stored in each thread's TLS area, which is not defined in the executable itself. The function itself has a different name, depending on the C library. This strange construct allows you to write "errno = <some value>" in thread-safe ways. It's a ugly hack required by legacy interfaces. > i know this problem may be architecture-specific. if so, please point it > out. no matter which arch, i found that building script appends option -z, > nocopyreloc. what's the purpose of that? some guys said android linker will > never be compatible with traditional dynamic linker(say, ld.linux.so). > are you sure that? who knows or where documents the differences? > source code. > > Best Regards, > --lx > > > > -- > unsubscribe: > android-porting+unsubscr...@googlegroups.com<android-porting%2bunsubscr...@googlegroups.com> > website: http://groups.google.com/group/android-porting > -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting