GitHub PushEvent at 2014-03-11 15:25:50
Repository: rust
Actor: alexcrichton
Payload: {"shas":[["699b33d060c5c9cc580d50cf3fe39536ae7a059a","60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcrichton.com","rustc: Support various flavors of linkages\n\nIt is often convenient to have forms of weak linkage or other various types of\nlinkage. Sadly, just using these flavors of linkage are not compatible with\nRust's typesystem and how it considers some pointers to be non-null.\n\nAs a compromise, this commit adds support for weak linkage to external symbols,\nbut it requires that this is only placed on extern statics of type `*T`.\nCodegen-wise, we get translations like:\n\n    // rust code\n    extern {\n        #[linkage = \"extern_weak\"]\n        static foo: *i32;\n    }\n\n    // generated IR\n    @foo = extern_weak global i32\n    @_some_internal_symbol = internal global *i32 @foo\n\nAll references to the rust value of `foo` then reference `_some_internal_symbol`\ninstead of the symbol `_foo` itself. This allows us to guarantee that the\naddress of `foo` will never be null while the value may sometimes be null.\n\nAn example was implemented in `std::rt::thread` to determine if\n`__pthread_get_minstack()` is available at runtime, and a test is checked in to\nuse it for a static value as well. Function pointers a little odd because you\nstill need to transmute the pointer value to a function pointer, but it's\nthankfully better than not having this capability at all.","Alex Crichton",true]],"size":1,"ref":"refs/heads/weak-linkage","head":"699b33d060c5c9cc580d50cf3fe39536ae7a059a"}