Re: writing a jump table

Nicolas Bock <[email protected]>
Newsgroups gmane.linux.assembly
Message-ID <[email protected]>
But how does non-PIC code where it is in memory? When I disassemble the
non-PIC version, the address space starts at 0 which must mean that the
linker relocates the code. Also, labels represent offsets if I
understand this correctly, which is also a relative address and not an
absolute. That's what I meant with that I don't fully understand why
these extra hoops are necessary.

On 03/16/11 20:23, Brian Raiter wrote:
>> I think I figured it out now. I used gcc to compile PIC for the C
>> switch statement and checked what it does. I don't fully understand
>> it to be honest, but it seems to do the job also for non PIC code.
> 
> Of course -- PIC code just means that the code doesn't assume it knows
> where it's located in memory, which for a shared-object library is a
> necessary thing. It does mean the code has to jump through a few more
> hoops, which is why the compiler doesn't make it the default.
> 
> b
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2BcT8ACgkQf15tZKyRylJD6QCg69LYd7W7reoH07I4vpll6/H7
2vwAnR77rm/hcQjeO0tYPIMdYVb9vqjL
=W2BP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.