pub struct Elsewhere { /* private fields */ }Expand description
The names whose address only the linker knows.
Two ways in, and the first one holds whichever link is coming. A function this file only declares is one, because a function cannot be copied: it has exactly one address that every object in the program has to agree on, or two pointers to it compare unequal, so the one address is what the table holds and what everything reads. A variable can be copied, and in an executable it is, since the linker answers a reference to one another object defines by making room for it here and copying it there, so the name really does end up somewhere this file can measure to.
The second way in is -fPIC, where the link may be one that produces a shared library and the
copying does not happen. There every replaceable name is in here, defined or not and function or
variable, because the definition the process ends up using may be in another object however
plainly this file defines it. What is not in here is what -fPIC costs nothing for: a static,
and a name marked hidden or protected, which is the reason -fPIC -fvisibility=hidden is the
combination a library that cares about its own speed is built with.
A name this module has never heard of is not in here. Nothing the front end writes produces one, and treating an unknown name as a function would put the addresses the instrumentation takes of its own tables through a table of their own for no reason.
A thread-local variable is kept separately and answered by Self::thread, because the two
questions have different answers rather than one being a case of the other: the table slot of an
ordinary name holds its address and the slot of a thread-local holds an offset, and reading
either as though it were the other is a wrong answer rather than a slower one.
Implementations§
Source§impl Elsewhere
impl Elsewhere
Sourcepub fn of(module: &Module, pic: Pic) -> Self
pub fn of(module: &Module, pic: Pic) -> Self
The names that link cannot reach from the instruction pointer.
Sourcepub fn holds(&self, name: Symbol) -> bool
pub fn holds(&self, name: Symbol) -> bool
Whether the address of that name has to be read out of the global offset table.
Sourcepub fn thread(&self, name: Symbol) -> bool
pub fn thread(&self, name: Symbol) -> bool
Whether that name is a variable every thread has its own copy of.
Asked before Self::holds and not instead of it, because the two answers are about
different things: a thread-local variable that another object may define is still reached
the same way, since the table slot holds an offset that is the same for every copy and the
question of whose copy is answered by the segment register rather than by the link.
Source§impl Elsewhere
impl Elsewhere
Sourcepub fn with_threads<T: IntoIterator<Item = Symbol>>(self, threads: T) -> Self
pub fn with_threads<T: IntoIterator<Item = Symbol>>(self, threads: T) -> Self
The same set with those names said to be thread-local, for a test that lowers one function.
Trait Implementations§
impl Eq for Elsewhere
Source§impl FromIterator<Symbol> for Elsewhere
The same set, written out by hand.
impl FromIterator<Symbol> for Elsewhere
The same set, written out by hand.
Elsewhere::of is how the driver builds one and is the only way a compilation does. This is
for a test that wants to lower one function and say what is outside the file without building a
module for it to be outside of.