Commit Graph

6 Commits

Author SHA1 Message Date
yvt
d3ebd42865 Support taking extern pointers at comptime
This commit makes it possible to obtain pointers to `extern` variables
at comptime.

 - `ir_get_var_ptr` employs several checks to determine if the given
   variable is eligible for obtaining its pointer at comptime. This
   commit alters these checks to consider `extern` variables, which have
   runtime values, as eligible.

 - After this change, it's now possible for `render_const_val` to be
   called for `extern` variables. This commit modifies
   `render_const_val` to suppress the value generation for `extern`
   variables.

 - `do_code_gen` now creates `ZigValue::llvm_global` of `extern`
   variables before iterating through module-level variables so that
   other module-level variables can refer to them.

This solution is incomplete since there are several cases still
failing:

 - `global_var.array[n..m]`
 - `&global_var.array[i]`
 - `&global_var.inner_struct.value`
 - `&global_array[i]`

Closes #5349
2020-07-24 13:33:17 -07:00
yvt
b747d4d1ce Enable the test standalone/global_linkage
This test was added to the source tree in c39d7a6, but has never been
referenced from anywhere.
2020-05-16 02:05:55 +09:00
Andrew Kelley
87b9e744dd
update std lib to new Target API 2020-02-28 14:51:54 -05:00
Andrew Kelley
fd6b7b160d
improve dynamic library API 2019-12-10 12:28:28 -05:00
emekoi
29fd727b79
fixed windows dynamic library loading and added loading for darwin 2019-12-10 11:41:54 -05:00
Andrew Kelley
9dcddc2249
retire the example/ folder, rename test-build-examples to "standalone"
closes #2759
2019-07-16 12:15:46 -04:00