This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
geneSmith wrote, On 5/12/2004 4:33 PM:Again for the record. A minor bug in O. Carmona's code. When used, a2 is a positive offset. With original code it was negative. Made it positive with 3 lines labeled new*: below.
Is it possible to compile with pc relative code and data references like you can with MRI (microtec) compiler, i.e.,
mcc68k -Mcp -Mdp -c xsubs.c ?
The closest I can find in gcc is the position independent flag, i.e.,
gcc -c -fpic xsub.c
but this produces some section .got and .got.plt which I have no idea how to use. I need to zero .bss and initialize .data also in a separate routine (probaby assembly).
Is anyone familiar with this?
Tks, -gene
For the record, this describes almost exactly what I was looking for. http://sources.redhat.com/ml/crossgcc/1999-q1/msg00170.html Thanks you Olivier Carmona!
/* Load the address relative to the PC */ lea (_GLOBAL_OFFSET_TABLE_,pc),a5 /* Load the address given by the linker */ movea.l #_GLOBAL_OFFSET_TABLE_,a2 /* Then find the offset */ suba.l a5,a2 beq L1 /* Null Offset ? */ new1: move.l a2,d1 new2: neg.l d1 new3: move.l d1,a2
/* Add the offset to all of the Global Offset Table */ move.l #gotsize,d1 /* gostize : linker variable */ L0: subq.l #4,d1 blt.b L1 /* End of GOT ? */ movea.l (a5,d1.l),a3 /* Read the GOT */ adda.l a2,a3 /* Add the offset */ move.l a3,(a5,d1.l) /* Write back in the GOT */ bra L0
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |