This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Global variables and shared libraries


On Wed, Nov 28, 2012 at 9:57 AM, Godmar Back <godmar@gmail.com> wrote:
> You're compiling your code without -fPIC. Consequently, the variable
> 'foo' is treated as a global variable, which is addressed using 32-bit
> relative to %rip.  It must thus be in the lower address range as per
> the x86_64 'small' model (so that's it no more than 4GB away from the
> %rip). That's why it's added to the bss section of the executable, and
> that's why a R_X86_64_COPY relocation entry appears in the libfoo.so
> file.
>
> See info gcc and look for -mcmodel=small

For those who wish to read more about COPY relocations...

"Copy Relocations"
http://docs.oracle.com/cd/E19082-01/819-0690/chapter4-84604/index.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]