commit
8d9d4a0658
|
@ -24,7 +24,7 @@ pub const DynLib = switch (builtin.os) {
|
|||
// fashion.
|
||||
const LinkMap = extern struct {
|
||||
l_addr: usize,
|
||||
l_name: [*]const u8,
|
||||
l_name: [*:0]const u8,
|
||||
l_ld: ?*elf.Dyn,
|
||||
l_next: ?*LinkMap,
|
||||
l_prev: ?*LinkMap,
|
||||
|
|
|
@ -612,7 +612,7 @@ pub const sockaddr_storage = extern struct {
|
|||
};
|
||||
pub const dl_phdr_info = extern struct {
|
||||
dlpi_addr: usize,
|
||||
dlpi_name: ?[*]const u8,
|
||||
dlpi_name: ?[*:0]const u8,
|
||||
dlpi_phdr: [*]std.elf.Phdr,
|
||||
dlpi_phnum: u16,
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ pub const RTLD_NOLOAD = 0x02000;
|
|||
|
||||
pub const dl_phdr_info = extern struct {
|
||||
dlpi_addr: usize,
|
||||
dlpi_name: ?[*]const u8,
|
||||
dlpi_name: ?[*:0]const u8,
|
||||
dlpi_phdr: [*]std.elf.Phdr,
|
||||
dlpi_phnum: u16,
|
||||
};
|
||||
|
|
|
@ -992,7 +992,7 @@ pub const dirent64 = extern struct {
|
|||
|
||||
pub const dl_phdr_info = extern struct {
|
||||
dlpi_addr: usize,
|
||||
dlpi_name: ?[*]const u8,
|
||||
dlpi_name: ?[*:0]const u8,
|
||||
dlpi_phdr: [*]std.elf.Phdr,
|
||||
dlpi_phnum: u16,
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ pub const Kevent = extern struct {
|
|||
|
||||
pub const dl_phdr_info = extern struct {
|
||||
dlpi_addr: usize,
|
||||
dlpi_name: ?[*]const u8,
|
||||
dlpi_name: ?[*:0]const u8,
|
||||
dlpi_phdr: [*]std.elf.Phdr,
|
||||
dlpi_phnum: u16,
|
||||
};
|
||||
|
|
|
@ -1042,7 +1042,7 @@ pub fn uname(uts: *utsname) usize {
|
|||
}
|
||||
|
||||
// XXX: This should be weak
|
||||
extern const __ehdr_start: elf.Ehdr = undefined;
|
||||
extern const __ehdr_start: elf.Ehdr;
|
||||
|
||||
pub fn dl_iterate_phdr(comptime T: type, callback: extern fn (info: *dl_phdr_info, size: usize, data: ?*T) i32, data: ?*T) isize {
|
||||
if (builtin.link_libc) {
|
||||
|
|
|
@ -16766,6 +16766,12 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio
|
|||
if (!symbol_name)
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
||||
if (buf_len(symbol_name) < 1) {
|
||||
ir_add_error(ira, name_inst,
|
||||
buf_sprintf("exported symbol name cannot be empty"));
|
||||
return ira->codegen->invalid_instruction;
|
||||
}
|
||||
|
||||
GlobalLinkageId global_linkage_id;
|
||||
if (!ir_resolve_global_linkage(ira, linkage_inst, &global_linkage_id))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
|
|
@ -930,6 +930,10 @@ static void ir_print_set_float_mode(IrPrint *irp, IrInstructionSetFloatMode *ins
|
|||
static void ir_print_array_type(IrPrint *irp, IrInstructionArrayType *instruction) {
|
||||
fprintf(irp->f, "[");
|
||||
ir_print_other_instruction(irp, instruction->size);
|
||||
if (instruction->sentinel != nullptr) {
|
||||
fprintf(irp->f, ":");
|
||||
ir_print_other_instruction(irp, instruction->sentinel);
|
||||
}
|
||||
fprintf(irp->f, "]");
|
||||
ir_print_other_instruction(irp, instruction->child_type);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,15 @@ const tests = @import("tests.zig");
|
|||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.addTest("@export with empty name string",
|
||||
\\pub export fn entry() void { }
|
||||
\\comptime {
|
||||
\\ @export(entry, .{ .name = "" });
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:3:5: error: exported symbol name cannot be empty",
|
||||
});
|
||||
|
||||
cases.addTest("switch ranges endpoints are validated",
|
||||
\\pub export fn entry() void {
|
||||
\\ var x: i32 = 0;
|
||||
|
|
Loading…
Reference in New Issue