rust/src/librustc/middle
Alex Crichton 699b33d060 rustc: Support various flavors of linkages
It is often convenient to have forms of weak linkage or other various types of
linkage. Sadly, just using these flavors of linkage are not compatible with
Rust's typesystem and how it considers some pointers to be non-null.

As a compromise, this commit adds support for weak linkage to external symbols,
but it requires that this is only placed on extern statics of type `*T`.
Codegen-wise, we get translations like:

    // rust code
    extern {
        #[linkage = "extern_weak"]
        static foo: *i32;
    }

    // generated IR
    @foo = extern_weak global i32
    @_some_internal_symbol = internal global *i32 @foo

All references to the rust value of `foo` then reference `_some_internal_symbol`
instead of the symbol `_foo` itself. This allows us to guarantee that the
address of `foo` will never be null while the value may sometimes be null.

An example was implemented in `std::rt::thread` to determine if
`__pthread_get_minstack()` is available at runtime, and a test is checked in to
use it for a static value as well. Function pointers a little odd because you
still need to transmute the pointer value to a function pointer, but it's
thankfully better than not having this capability at all.
2014-03-11 08:25:42 -07:00
..
borrowck librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
cfg librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
trans rustc: Support various flavors of linkages 2014-03-11 08:25:42 -07:00
typeck librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
astencode.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
check_const.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
check_loop.rs
check_match.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
check_static.rs Immutable static items should be Freeze Fixes #12432 2014-02-27 18:09:35 +01:00
const_eval.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
dataflow.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
dead.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
effect.rs Replace callee_id with information stored in method_map. 2014-02-26 16:06:45 +02:00
entry.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
freevars.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
graph.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
kind.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
lang_items.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
lint.rs rustc: Support various flavors of linkages 2014-03-11 08:25:42 -07:00
liveness.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
mem_categorization.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
moves.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
pat_util.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
privacy.rs rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and clean::ExternMod to clean::ExternCrate 2014-03-07 15:57:45 +08:00
reachable.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
region.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
resolve_lifetime.rs rustc: Move to FNV hashing for node/def ids 2014-03-06 17:45:48 -08:00
resolve.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
subst.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
ty_fold.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
ty.rs librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00