From: Nicolas Bock <nicolasbock@gmail.com>
To: Brian Raiter <breadbox@muppetlabs.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: writing a jump table
Date: Wed, 16 Mar 2011 20:26:07 -0600 [thread overview]
Message-ID: <4D81713F.8040909@gmail.com> (raw)
In-Reply-To: <19841.28812.233966.341511@eidolon.muppetlabs.com>
[-- Attachment #1: Type: text/plain, Size: 940 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2011-03-17 2:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-16 0:10 writing a jump table Nicolas Bock
2011-03-16 0:25 ` Brian Raiter
2011-03-16 14:13 ` Nicolas Bock
2011-03-16 14:26 ` Frank Kotler
2011-03-16 16:48 ` Nicolas Bock
2011-03-16 16:57 ` Nicolas Bock
2011-03-17 2:12 ` Nicolas Bock
2011-03-17 2:23 ` Brian Raiter
2011-03-17 2:26 ` Nicolas Bock [this message]
[not found] ` <AANLkTinzgyzwN3Zj7bmqw7tDF0QKDSJiJj7MQt7vFx-h@mail.gmail.com>
2011-03-17 10:11 ` Fwd: " Hendrik Visage
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D81713F.8040909@gmail.com \
--to=nicolasbock@gmail.com \
--cc=breadbox@muppetlabs.com \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.