Re: Problem creating PIC executable

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

 



Hi!
 Thank you very much for your answer!
Are you the same author of this great blog http://www.airs.com/blog/archives/category/programming/page/21 ? If so I could not be luckier! :) There can't be a more expert developer for helping me with this problem! :)

I'll post all the output, surely it will tell much more to you than to me ...

RUNNERS_CFLAGS   = -fPIC

$(RUNNERS_OBJ_DIR)/testppc.o: $(RUNNERS_SRC_DIR)/testppc.c
    $(CC) -c -o $@ $< $(RUNNERS_CFLAGS)

testppc.c is the simplest c program:
int main(int argc, char* argv[])
{

}
I linked it with the following:
TEST_DEC_BIN = $(BIN_DIR)/ppc-test

test_bin: $(RUNNERS_OBJ_DIR)/testppc.o
    @echo
    @echo 'creating test binary'
$(CC) -fPIC -Wl,--verbose -Wl,-pie -v -o $(TEST_DEC_BIN) $(RUNNERS_OBJ_DIR)/testppc.o > $(TEST_DEC_BIN).linking.txt

the output is here : http://cid-9d0dd0f6c6e22fe8.office.live.com/self.aspx/Documenti/ppc-test.linking.txt
(It is too long for direct posting I think)

the output of the following

$(CC) -fPIC -Wl,--verbose -Wl,-pie -v -o $(TEST_DEC_BIN) $(RUNNERS_OBJ_DIR)/testppc.o 2> $(TEST_DEC_BIN).linking2.txt

is here:

http://cid-9d0dd0f6c6e22fe8.office.live.com/self.aspx/Documenti/ppc-test.linking2.txt

Suspecting that there could be some file wrongly linked without fPIC, I have tried the following command:

"readelf -d myobjectfile | fgrep TEXT"


to all object files opened here: http://cid-9d0dd0f6c6e22fe8.office.live.com/self.aspx/Documenti/ppc-test.linking.txt but I could not see anything.. all seemed to be PIC .. I dunno if there is any other way for checking if an object file or shared file is really PIC
the same command on the final executable gives:

0x00000016 (TEXTREL)   0x0


I am only a student who studies for the first time linkers, loaders on articles like Yours (thank you! :) ).. I have got a strict deadline, and atm no idea on how to get rid of this problem alone .. I can post all output from objdump, readelf or whatever can help you in understanding what's wrong here..
Thank you very much in advance!
Stefano B.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux