fix @bitCast regressions

This commit is contained in:
Andrew Kelley 2019-06-12 13:42:21 -04:00
parent ce5d50e4ed
commit 278c7a2bc3
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 14 additions and 13 deletions

View File

@ -4951,6 +4951,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo
ResultLocBitCast *result_loc_bit_cast = allocate<ResultLocBitCast>(1);
result_loc_bit_cast->base.id = ResultLocIdBitCast;
result_loc_bit_cast->base.source_instruction = dest_type;
ir_ref_instruction(dest_type, irb->current_basic_block);
result_loc_bit_cast->parent = result_loc;
AstNode *arg1_node = node->data.fn_call_expr.params.at(1);
@ -24219,7 +24220,7 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct
static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInstructionBitCastSrc *instruction) {
IrInstruction *operand = instruction->operand->child;
if (type_is_invalid(operand->value.type) || instr_is_comptime(operand) ||
if (type_is_invalid(operand->value.type) ||
instruction->result_loc_bit_cast->parent->gen_instruction == nullptr)
{
return operand;

View File

@ -78,19 +78,19 @@ fn posixCallMainAndExit() noreturn {
while (envp_optional[envp_count]) |_| : (envp_count += 1) {}
const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count];
if (builtin.os == .linux) {
// Find the beginning of the auxiliary vector
const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1);
std.os.linux.elf_aux_maybe = auxv;
// Initialize the TLS area
std.os.linux.tls.initTLS();
//if (builtin.os == .linux) {
// // Find the beginning of the auxiliary vector
// const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1);
// std.os.linux.elf_aux_maybe = auxv;
// // Initialize the TLS area
// std.os.linux.tls.initTLS();
if (std.os.linux.tls.tls_image) |tls_img| {
const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);
const tp = std.os.linux.tls.copyTLS(tls_addr);
std.os.linux.tls.setThreadPointer(tp);
}
}
// if (std.os.linux.tls.tls_image) |tls_img| {
// const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);
// const tp = std.os.linux.tls.copyTLS(tls_addr);
// std.os.linux.tls.setThreadPointer(tp);
// }
//}
std.os.exit(callMainWithArgs(argc, argv, envp));
}