authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-16 05:43:17+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-02 10:42:53+01:00
log43878f51d94a6c6297053fff37426fa556b1ef9c
treebfb3566fc69f586f9c506bad132fa256c5d6affa
parent50cae505f74d0d8507129b5ea5cc52b2b21b3f8d
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

glibc: Emit _IO_stdin_used reference in .rodata.

This fixes an X86_64_32 relocation linker error when targeting gnux32.

1 files changed, 3 insertions(+), 1 deletions(-)

src/glibc.zig+3-1
...@@ -1015,7 +1015,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi...@@ -1015,7 +1015,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
1015 }1015 }
1016 }1016 }
10171017
1018 try stubs_asm.appendSlice(".data\n");1018 try stubs_asm.appendSlice(".rodata\n");
10191019
1020 // For some targets, the real `libc.so.6` will contain a weak reference to `_IO_stdin_used`,1020 // For some targets, the real `libc.so.6` will contain a weak reference to `_IO_stdin_used`,
1021 // making the linker put the symbol in the dynamic symbol table. We likewise need to emit a1021 // 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...@@ -1046,6 +1046,8 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
1046 });1046 });
1047 }1047 }
10481048
1049 try stubs_asm.appendSlice(".data\n");
1050
1049 const obj_inclusions_len = try inc_reader.readInt(u16, .little);1051 const obj_inclusions_len = try inc_reader.readInt(u16, .little);
10501052
1051 sym_i = 0;1053 sym_i = 0;