diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-02-10 10:58:00 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-02-10 11:07:00 -0500 |
| commit | 7a8f391b0fa397eea4a9602a0132e0247d0f67b7 (patch) | |
| tree | bec959df7cd42b36bea7ab80c93bda4283eee155 /deps/lld/ELF/ScriptParser.cpp | |
| parent | bcbcb2e9ffbfef63d3692ea45eea2e2babacc3a9 (diff) | |
| download | zig-7a8f391b0fa397eea4a9602a0132e0247d0f67b7.tar.gz zig-7a8f391b0fa397eea4a9602a0132e0247d0f67b7.zip | |
avoid needlessly creating global constants
This deletes some legacy cruft, and produces leaner object files.
Example:
```
var x: i32 = 1234;
export fn entry() i32 {
return x;
}
```
This produces:
```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```
and @0 is never even used. After this commit, @0 is not produced.
This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.
https://bugs.llvm.org/show_bug.cgi?id=40652
Diffstat (limited to 'deps/lld/ELF/ScriptParser.cpp')
0 files changed, 0 insertions, 0 deletions
