ideal visibility setting?

Ian Lance Taylor iant@google.com
Fri May 21 00:47:00 GMT 2010


Jay K <jay.krell@cornell.edu> writes:

> Data accesses I would assume are almost never cross-.dso.
> The rare ones would be source-annotated with some sort of "import",
> and the compiler would generate less efficient but PIC code for them.

First, that just isn't how ELF works.  ELF has a very simple model:
everything simply works correctly without source code annotation, and
symbol interposition works.  You are looking for a more complex model
at the cost of adding source code annotations.  That's not crazy, but
it's not ELF.

Second, I still don't understand how you can have position independent
code on 32-bit x86 which accesses global variables but does not use a
GOT.

> This is basically the Win32/NT model and seems pretty good.

The model is good until you need to use symbol interpositioning.
Symbol interpositioning is not a bizarre technique that nobody uses.
People use it regularly to, e.g., use debugging malloc code, or to add
profiling timers to all network accesses.

Ian



More information about the Gcc-help mailing list