glibc: Emit some fill data for stub symbols, thus giving each a unique address.

This prevents LLVM from...cleverly...merging all of the global variable stub
symbols that we emit under certain circumstances. This was observed in practice
when using zig-bootstrap for arm-linux-gnueabi(hf).
This commit is contained in:
Alex Rønne Petersen 2024-10-12 22:44:03 +02:00
parent 7e530c13b3
commit 7b376b1c54
No known key found for this signature in database

View File

@ -938,7 +938,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
// .globl _Exit_2_2_5
// .type _Exit_2_2_5, %function;
// .symver _Exit_2_2_5, _Exit@@GLIBC_2.2.5
// _Exit_2_2_5:
// _Exit_2_2_5: .long 0
const ver_index = versions_buffer[ver_buf_i];
const ver = metadata.all_versions[ver_index];
@ -960,7 +960,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
\\.globl {s}
\\.type {s}, %function;
\\.symver {s}, {s}{s}GLIBC_{d}.{d}
\\{s}:
\\{s}: {s} 0
\\
, .{
sym_plus_ver,
@ -971,6 +971,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
ver.major,
ver.minor,
sym_plus_ver,
wordDirective(target),
});
} else {
const sym_plus_ver = if (want_default)
@ -985,7 +986,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
\\.globl {s}
\\.type {s}, %function;
\\.symver {s}, {s}{s}GLIBC_{d}.{d}.{d}
\\{s}:
\\{s}: {s} 0
\\
, .{
sym_plus_ver,
@ -997,6 +998,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
ver.minor,
ver.patch,
sym_plus_ver,
wordDirective(target),
});
}
}
@ -1103,7 +1105,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
// .type environ_2_2_5, %object;
// .size environ_2_2_5, 4;
// .symver environ_2_2_5, environ@@GLIBC_2.2.5
// environ_2_2_5:
// environ_2_2_5: .fill 4, 1, 0
const ver_index = versions_buffer[ver_buf_i];
const ver = metadata.all_versions[ver_index];
@ -1126,7 +1128,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
\\.type {s}, %object;
\\.size {s}, {d};
\\.symver {s}, {s}{s}GLIBC_{d}.{d}
\\{s}:
\\{s}: .fill {d}, 1, 0
\\
, .{
sym_plus_ver,
@ -1139,6 +1141,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
ver.major,
ver.minor,
sym_plus_ver,
size,
});
} else {
const sym_plus_ver = if (want_default)
@ -1154,7 +1157,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
\\.type {s}, %object;
\\.size {s}, {d};
\\.symver {s}, {s}{s}GLIBC_{d}.{d}.{d}
\\{s}:
\\{s}: .fill {d}, 1, 0
\\
, .{
sym_plus_ver,
@ -1168,6 +1171,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
ver.minor,
ver.patch,
sym_plus_ver,
size,
});
}
}