@@ -1069,7 +1069,7 @@ pub const File = struct {
10691069 errdefer archive .file .close ();
10701070 loadInput (base , .{ .archive = archive }) catch | err | switch (err ) {
10711071 error .BadMagic , error .UnexpectedEndOfFile = > {
1072- if (base .tag != .elf ) return err ;
1072+ if (base .tag != .elf and base . tag != .elf2 ) return err ;
10731073 try loadGnuLdScript (base , path , query , archive .file );
10741074 archive .file .close ();
10751075 return ;
@@ -1091,7 +1091,7 @@ pub const File = struct {
10911091 errdefer dso .file .close ();
10921092 loadInput (base , .{ .dso = dso }) catch | err | switch (err ) {
10931093 error .BadMagic , error .UnexpectedEndOfFile = > {
1094- if (base .tag != .elf ) return err ;
1094+ if (base .tag != .elf and base . tag != .elf2 ) return err ;
10951095 try loadGnuLdScript (base , path , query , dso .file );
10961096 dso .file .close ();
10971097 return ;
@@ -1101,8 +1101,9 @@ pub const File = struct {
11011101 }
11021102
11031103 fn loadGnuLdScript (base : * File , path : Path , parent_query : UnresolvedInput.Query , file : fs.File ) anyerror ! void {
1104- const diags = & base .comp .link_diags ;
1105- const gpa = base .comp .gpa ;
1104+ const comp = base .comp ;
1105+ const diags = & comp .link_diags ;
1106+ const gpa = comp .gpa ;
11061107 const stat = try file .stat ();
11071108 const size = std .math .cast (u32 , stat .size ) orelse return error .FileTooBig ;
11081109 const buf = try gpa .alloc (u8 , size );
@@ -1124,7 +1125,11 @@ pub const File = struct {
11241125 @panic ("TODO" );
11251126 } else {
11261127 if (fs .path .isAbsolute (arg .path )) {
1127- const new_path = Path .initCwd (try gpa .dupe (u8 , arg .path ));
1128+ const new_path = Path .initCwd (path : {
1129+ comp .mutex .lock ();
1130+ defer comp .mutex .unlock ();
1131+ break :path try comp .arena .dupe (u8 , arg .path );
1132+ });
11281133 switch (Compilation .classifyFileExt (arg .path )) {
11291134 .shared_library = > try openLoadDso (base , new_path , query ),
11301135 .object = > try openLoadObject (base , new_path ),
0 commit comments