Re: When do I need PIC?

"joshc" <josh.curtz@gmail.com>
4 Aug 2006 16:37:55 -0400

          From comp.compilers

Related articles
When do I need PIC? josh.curtz@gmail.com (joshc) (2006-07-28)
Re: When do I need PIC? vzweije@sense.net (Vincent Zweije) (2006-07-29)
Re: When do I need PIC? josh.curtz@gmail.com (joshc) (2006-07-31)
Re: When do I need PIC? kym@otaku.freeshell.org (russell kym horsell) (2006-08-03)
Re: When do I need PIC? josh.curtz@gmail.com (joshc) (2006-08-04)
Re: When do I need PIC? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-08-09)
| List of all articles for this month |

From: "joshc" <josh.curtz@gmail.com>
Newsgroups: comp.compilers
Date: 4 Aug 2006 16:37:55 -0400
Organization: http://groups.google.com
References: 06-07-09206-07-116 06-08-006
Keywords: architecture, code
Posted-Date: 04 Aug 2006 16:37:55 EDT

> Your original question has pretty much been answered. But maybe you
> really are asking the quetion "how can I tell whether my code is
> already position independent?".


No, I already said I can look at the assembler listing and can easily
tell if the compiler generated code that is position independent. That
wasn't quite my question, but...


> The best idea would probably be to create an edit script (e.g.) to look
> at the asm output and extract "features" (a la AI probs) that indicate
> the code is NOT position indep. E.g. sometimes "@$" or somesuch indicates
> a ref to an absolute address. Most (all?) refs to abs addrs indicate non-PIC
> code. But there are bound to be a load of tricks.


I thank you for this part of your response. That is the insight I was
looking for. I was looking for the "style of C code that results in
being PIC" most of the time but as you and previous posters mentioned
this is highly architecture dependent. And with that, my original
question has now been answered.


Thanks.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.