From: Alexander Gabert <pappy@nikita.ath.cx>
To: parisc-linux@parisc-linux.org
Subject: [parisc-linux] -fPIC position independent code on parisc
Date: Sun, 27 Apr 2003 22:04:18 +0200 [thread overview]
Message-ID: <20030427200418.GA30929@nikita.ath.cx> (raw)
hi,
can someone explain the difference between "normal" and "-fPIC"?
i have compiled a test program:
#include <stdio.h>
int main(void) {
printf("hello\n");
return(0);
}
first one without -fPIC
gcc -S hello.c
1 .LEVEL 1.1
2 .section .rodata
3 .align 4
4 .LC0:
5 .stringz"hello\n"
6 .text
7 .align 4
8 .globl main
9 .type main,@function
10 main:
11 .PROC
12 .CALLINFO FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3
13 .ENTRY
14 stw %r2,-20(%r30)
15 copy %r3,%r1
16 copy %r30,%r3
17 stwm %r1,64(%r30)
18 ldil LR'.LC0,%r19
19 ldo RR'.LC0(%r19),%r26
20 bl printf,%r2
21 nop
22 ldi 0,%r28
23 ldw -20(%r3),%r2
24 ldo 64(%r3),%r30
25 ldwm -64(%r30),%r3
26 bv,n %r0(%r2)
27 .EXIT
28 .PROCEND
29 .Lfe1:
30 .size main,.Lfe1-main
31 .ident "GCC: (GNU) 3.0.4"
second one with -fPIC
gcc -S -fPIC hello_fPIC.c
1 .LEVEL 1.1
2 .section .rodata
3 .align 4
4 .LC0:
5 .stringz"hello\n"
6 .text
7 .align 4
8 .globl main
9 .type main,@function
10 main:
11 .PROC
12 .CALLINFO FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4
13 .ENTRY
14 stw %r2,-20(%r30)
15 copy %r3,%r1
16 copy %r30,%r3
17 stwm %r1,64(%r30)
18 stw %r4,8(%r3)
19 stw %r19,-32(%r30)
20 copy %r19,%r4
21 addil LT'.LC0,%r19
22 ldw RT'.LC0(%r1),%r1
23 copy %r1,%r26
24 bl printf,%r2
25 nop
26 copy %r4,%r19
27 ldi 0,%r28
28 ldw -20(%r3),%r2
29 ldw 8(%r3),%r4
30 ldo 64(%r3),%r30
31 ldwm -64(%r30),%r3
32 bv,n %r0(%r2)
33 .EXIT
34 .PROCEND
35 .Lfe1:
36 .size main,.Lfe1-main
37 .ident "GCC: (GNU) 3.0.4"
i know that it is needed for shared libraries...
but what exactly is position independent code?
gcc is version 3.0.4
glibc is version 2.2.5
thanks in advance,
Alex
--
pub 1024/05E1A80C 2001/12/16 Alexander Gabert (http://nikita.ath.cx) <pappy@nikita.ath.cx>
Key fingerprint = 2D 84 B0 CB F5 67 8A 22 8D 37 6E 6B 8A 3B 7F D6 05 E1 A8 0C
next reply other threads:[~2003-04-27 20:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-27 20:04 Alexander Gabert [this message]
2003-04-27 20:12 ` [parisc-linux] -fPIC position independent code on parisc Randolph Chung
[not found] ` <20030427231210.GA31520@nikita.ath.cx>
2003-04-27 22:34 ` Randolph Chung
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=20030427200418.GA30929@nikita.ath.cx \
--to=pappy@nikita.ath.cx \
--cc=parisc-linux@parisc-linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox