Here's a quick example: collage0021# elfdump -c data.so collage0021# more data.c static int local_var = 0; int *global_data = &local_var; collage0021# gcc -fpic -shared data.c -o data.so collage0021# elfdump -r data.so | grep RELATIVE R_386_RELATIVE 0x105cc .rel.data.rel. R_386_RELATIVE 0x105d0 .rel.data.rel. collage0021# elfdump -r data.so | grep RELATIVE collage0021# nm -xv data.so | grep 105d0 [63] |0x000105d0|0x00000004|OBJT |GLOB |0 |20 |global_data collage0021#
Notice that the RELATIVE relocation against 0x105d0 is against the 'global_data' symbol. So - it's going to adjust the value of '&local_data' (which is already stored there) with the offset of the library (data.so) when it's loaded into its final location in memory. _Mike_ On 2/21/07, bhushan verma <bhushan.verma at iap-online.net> wrote: > Hi > can anyone give me an c example which produces R_386_RELATIVE type relocation > Thanks > > > This message posted from opensolaris.org > _______________________________________________ > tools-linking mailing list > tools-linking at opensolaris.org > > -- Michael Walker mwalker at fins.com