update defer imp link test

This commit is contained in:
Nikita Smith
2026-04-22 18:38:03 -07:00
parent 435b5183fb
commit 05d76b416a
+24 -56
View File
@@ -4466,67 +4466,35 @@ TEST(second_member_header)
} }
#if 0 #if 0
TEST(multibyte) TEST(defer_imp_link)
{ {
String8 a_obj = t_coff_obj_from_string(arena, str8_lit("'machine': 'x64', \n\ String8 bar_lib = t_coff_lib_from_string(arena, str8_lit("'import': { 'dll_name': 'bar.dll', 'name': 'bar', 'import_by': 'name', 'hint_or_ordinal': 0, 'type': 'code' }, \
'sections': [ \n\ 'obj': { \
{ \n\ 'machine': 'x64', \
'id': 'text', \n\ 'sections': [ { 'id': 'text', 'name': '.text', 'flags': 'code', 'data': [ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00 ], 'relocs': [ { 'kind': 'rel32', 'apply_off': 2, 'symbol': 'bar' } ] } ], \
'name': '.text', \n\ 'symbols': [ \
'flags': 'code', \n\ { 'kind': 'undef', 'name': '__imp_bar' }, \
'data': [ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, \n\ { 'kind': 'extern_func', 'name': 'qwe', 'section': 'text', 'value': 0 }, \
0xff, 0x25, 0x00, 0x00, 0x00, 0x00 ], \n\ ], \
'relocs': [ \n\ }, \
{ 'kind': 'rel32', 'apply_off': 2, 'symbol': 'foo' }, \n\ "));
], \n\
}, \n\
], \n\
'symbols': [ \n\
{ 'kind': 'extern_func', 'name': 'use_imports', 'value': 0, 'section': 'text' }, \n\
{ 'kind': 'undef', 'name': 'foo' }, \n\
]"));
String8 aa_obj = t_coff_obj_from_string(arena, str8_lit("'machine': 'x64', \n\ String8 foo_lib = t_coff_lib_from_string(arena, str8_lit("'import': { 'dll_name': 'foo.dll', 'name': 'bar', 'import_by': 'name', 'hint_or_ordinal': 0, 'type': 'code' }, \
'sections': [ \n\ 'obj': { \
{ \n\ 'machine': 'x64', \
'id': 'text', \n\ 'sections': [ { 'id': 'text', 'name': '.text', 'flags': 'code', 'data': [ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00 ], 'relocs': [ { 'kind': 'rel32', 'apply_off': 2, 'symbol': 'bar' } ] } ], \
'name': '.text', \n\ 'symbols': [ \
'flags': 'code', \n\ { 'kind': 'undef', 'name': 'bar' }, \
'data': [ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, \n\ { 'kind': 'undef', 'name': 'qwe' }, \
0xff, 0x25, 0x00, 0x00, 0x00, 0x00 ], \n\ { 'kind': 'extern_func', 'name': 'thunk', 'section': 'text', 'value': 0 }, \
'relocs': [ \n\ ], \
{ 'kind': 'rel32', 'apply_off': 2, 'symbol': '__imp_foo' }, \n\ }"));
], \n\
}, \n\
], \n\
'symbols': [ \n\
{ 'kind': 'extern_func', 'name': 'use_imports', 'value': 0, 'section': 'text' }, \n\
{ 'kind': 'undef', 'name': '__imp_foo' }, \n\
]"));
String8 b_lib = t_coff_lib_from_string(arena, str8_lit("'import': { \n\ T_Ok(t_write_file(str8_lit("bar.lib"), bar_lib));
'dll_name': 'foo.dll', \n\ T_Ok(t_write_file(str8_lit("foo.lib"), foo_lib));
'name': 'foo', \n\
'import_by': 'name', \n\
'hint_or_ordinal': 0, \n\
'type': 'code', \n\
}"));
String8 c_lib = t_coff_lib_from_string(arena, str8_lit("'import': { \n\
'dll_name': 'foo.dll', \n\
'name': '__imp_foo', \n\
'import_by': 'name', \n\
'hint_or_ordinal': 0, \n\
'type': 'code', \n\
}"));
T_Ok(t_write_file(str8_lit("a.obj"), a_obj));
T_Ok(t_write_file(str8_lit("aa.obj"), aa_obj));
T_Ok(t_write_file(str8_lit("b.lib"), b_lib));
T_Ok(t_write_file(str8_lit("c.lib"), c_lib));
T_Ok(t_write_entry_obj()); T_Ok(t_write_entry_obj());
t_invoke_linkerf("/subsystem:console /entry:entry /out:a.exe a.obj b.lib c.lib entry.obj /include:use_imports"); t_invoke_linkerf("/subsystem:console /entry:entry /out:a.exe bar.lib foo.lib entry.obj /include:thunk");
T_Ok(g_last_exit_code == 0); T_Ok(g_last_exit_code == 0);
} }
#endif #endif