This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: simulating section-gc with ar-archives?



Ian Lance Taylor <ian@airs.com> writes:
> > one section to a static variable in another section be handled by a
> > reloc with the symbol name of the static variable?

> By file static variable, I mean something like `static int i;'.  Such
> a symbol has no externally visible name--it can not have an externally
> visible name, because there is no way to ensure that name is unique
> across an entire program.  Without an externally visible name, there
> is no way to resolve a reference from one .o file to another.

Interesting. My understanding of UNIX binary formats isn't too
great. I thought that if a function in one section accessed a global
variable in another section, that the compiler would have to concoct a
symbol name for the variable, and emit a relocation for the
function. If this isn't the case, how do functions refer to variables
in other sections? AFAIK a simple offset wouldn't work since sections
can be reordered in the final executable, right?

Anyways, if everything above is correct, and I used both
-ffunction-sections and -fdata-sections, I would get made-up symbol
names for all my globals, and relocations for any functions that
accessed the globals, right? If this is the case, would splitting the
.o's by section and then linking them back together work?

  - a


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]