Commit 43878f51d9

Alex Rønne Petersen <alex@alexrp.com>
2024-10-16 05:43:17
glibc: Emit _IO_stdin_used reference in .rodata.
This fixes an X86_64_32 relocation linker error when targeting gnux32.
1 parent 50cae50
Changed files (1)
src/glibc.zig
@@ -1015,7 +1015,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
             }
         }
 
-        try stubs_asm.appendSlice(".data\n");
+        try stubs_asm.appendSlice(".rodata\n");
 
         // For some targets, the real `libc.so.6` will contain a weak reference to `_IO_stdin_used`,
         // making the linker put the symbol in the dynamic symbol table. We likewise need to emit a
@@ -1046,6 +1046,8 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
             });
         }
 
+        try stubs_asm.appendSlice(".data\n");
+
         const obj_inclusions_len = try inc_reader.readInt(u16, .little);
 
         sym_i = 0;