| ... | ... | @@ -789,6 +789,7 @@ fn create( |
| 789 | 789 | minor_subsystem_version, |
| 790 | 790 | magic, |
| 791 | 791 | section_align, |
| 792 | std.fs.path.basename(path.sub_path), |
| 792 | 793 | ); |
| 793 | 794 | return coff; |
| 794 | 795 | } |
| ... | ... | @@ -823,6 +824,7 @@ fn initHeaders( |
| 823 | 824 | minor_subsystem_version: u16, |
| 824 | 825 | magic: std.coff.OptionalHeader.Magic, |
| 825 | 826 | section_align: std.mem.Alignment, |
| 827 | file_name: []const u8, |
| 826 | 828 | ) !void { |
| 827 | 829 | const comp = coff.base.comp; |
| 828 | 830 | const gpa = comp.gpa; |
| ... | ... | @@ -1063,27 +1065,27 @@ fn initHeaders( |
| 1063 | 1065 | ); |
| 1064 | 1066 | coff.nodes.appendAssumeCapacity(.import_directory_table); |
| 1065 | 1067 | |
| 1066 | | { |
| 1067 | | // TODO: Could create this lazily when processing the first export instead? |
| 1068 | if (is_image) { |
| 1068 | 1069 | const edata_section_ni = (try coff.pseudoSectionMapIndex( |
| 1069 | 1070 | .@".edata", |
| 1070 | 1071 | .of(std.coff.ExportDirectoryTable), |
| 1071 | 1072 | .{ .read = true }, |
| 1072 | 1073 | )).symbol(coff).node(coff); |
| 1073 | 1074 | |
| 1074 | | const name = "TODO_NAME.dll"; |
| 1075 | | const name_index = @sizeOf(std.coff.ExportDirectoryTable); |
| 1076 | 1075 | coff.export_table.ni = try coff.mf.addLastChildNode( |
| 1077 | 1076 | gpa, |
| 1078 | 1077 | edata_section_ni, |
| 1079 | 1078 | .{ |
| 1080 | | .size = @sizeOf(std.coff.ExportDirectoryTable) + name.len + 1, |
| 1079 | .size = @sizeOf(std.coff.ExportDirectoryTable) + file_name.len + 1, |
| 1081 | 1080 | .alignment = .of(std.coff.ExportDirectoryTable), |
| 1082 | 1081 | .fixed = true, |
| 1083 | 1082 | .moved = true, |
| 1084 | 1083 | }, |
| 1085 | 1084 | ); |
| 1086 | | @memcpy(coff.export_table.ni.slice(&coff.mf)[name_index..][0 .. name.len + 1], name[0 .. name.len + 1]); |
| 1085 | |
| 1086 | const name_index = @sizeOf(std.coff.ExportDirectoryTable); |
| 1087 | @memcpy(coff.export_table.ni.slice(&coff.mf)[name_index..][0..file_name.len], file_name[0..file_name.len]); |
| 1088 | @memset(coff.export_table.ni.slice(&coff.mf)[name_index + file_name.len ..], 0); |
| 1087 | 1089 | |
| 1088 | 1090 | const export_address_table_ni = try coff.mf.addLastChildNode(gpa, edata_section_ni, .{ |
| 1089 | 1091 | .alignment = .of(u32), |
| ... | ... | @@ -2600,6 +2602,8 @@ fn updateExportsInner( |
| 2600 | 2602 | std.mem.byteSwapAllFields(std.coff.ImageDataDirectory, tls_directory); |
| 2601 | 2603 | } |
| 2602 | 2604 | |
| 2605 | if (coff.export_table.ni == .none) continue; |
| 2606 | |
| 2603 | 2607 | const entries_ctx = ExportTable.Adapter{ .coff = coff }; |
| 2604 | 2608 | const gop = try coff.export_table.entries.getOrPutAdapted( |
| 2605 | 2609 | gpa, |