[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Error creating a PIC EXECUTABLE in a POWER-PC Debian



Hi all!
I am reposting the previous problem, as after some investigation the problem is more clear:there is some error creating a PIC EXECUTABLE in a POWER-PC Debian6!

Even when creating the simplest code:
int main() {}

compiling with "gcc -fPIC" and then linking with "gcc -Wl,-pie" produces non PIC code:

checking all the linked object files (also those added by gcc) with "readelf -d myobjectfile | fgrep TEXT" all seem to be PIC as nothing is produced by the previous command. Oddly giving the command "readelf -d mypie_executable | fgrep TEXT" to my final 'PIC' output executable I get: "0x00000016 (TEXTREL) 0x0" Then if I try to load the file with QEMU-USER I get: "error while loading shared libraries: R_PPC_REL24 relocation at 0xb31f95a0 for symbol `__libc_start_main' out of range" !!!

If I link with "-shared" all is fine and the library is PIC.. Also if I create a normal executable, or a normal executable relocated at linker time with "-Wl,-Ttext-segment=myaddress" all is fine..
I think the linker goes crazy as I want a PIC executable not a library!

I am creating the binaries using Debian 6 kernel 2.6.32.5 powerpc running in a qemu VM, with gcc 4.4.5-8, binutils 2.20.1 eglibc 2.11.2-10

I have outputs of dumps of objdump, readelf, and Map here:

http://cid-9d0dd0f6c6e22fe8.office.live.com/browse.aspx/Public/Developing/master-degree-project?uc=2


Please help!! I really dunno how to solve it!
Thank you very much in advance!
Stefano B.



Reply to: