Skip to content

Commit d1cea5f

Browse files
committed
---
yaml --- r: 2283 b: refs/heads/master c: 7b95b5c h: refs/heads/master i: 2281: ccfe4d2 2279: 9c2db4a v: v3
1 parent 2ebfbbc commit d1cea5f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: c39a95da90a3d8247e011f6a42f0c53ced34de97
2+
refs/heads/master: 7b95b5c033435e0b8902c3f3afb14c80e04fee83

trunk/src/comp/middle/metadata.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ mod Encode {
235235
}
236236

237237

238-
// Returns a Plain Old LLVM String, *without* the trailing zero byte.
238+
// Returns a Plain Old LLVM String.
239239
fn C_postr(str s) -> ValueRef {
240-
ret llvm.LLVMConstString(_str.buf(s), _str.byte_len(s) - 1u, False);
240+
ret llvm.LLVMConstString(_str.buf(s), _str.byte_len(s), False);
241241
}
242242

243243

@@ -674,8 +674,11 @@ fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate)
674674
ret C_postr(string_w.get_str());
675675
}
676676

677-
fn write_metadata(@trans.crate_ctxt cx, @ast.crate crate) {
678-
auto llmeta = encode_metadata(cx, crate);
677+
fn write_metadata(@trans.crate_ctxt cx, bool shared, @ast.crate crate) {
678+
auto llmeta = C_postr("");
679+
if (shared) {
680+
llmeta = encode_metadata(cx, crate);
681+
}
679682

680683
auto llconst = trans.C_struct(vec(llmeta));
681684
auto llglobal = llvm.LLVMAddGlobal(cx.llmod, trans.val_ty(llconst),

trunk/src/comp/middle/trans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7747,7 +7747,7 @@ fn trans_crate(session.session sess, @ast.crate crate, ty.ctxt tcx,
77477747
}
77487748

77497749
// Translate the metadata.
7750-
middle.metadata.write_metadata(cx.ccx, crate);
7750+
middle.metadata.write_metadata(cx.ccx, shared, crate);
77517751

77527752
run_passes(llmod, optimize, verify, save_temps, output, ot);
77537753
}

0 commit comments

Comments
 (0)