authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-12 22:44:03+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-12 23:01:05+02:00
log7b376b1c54d79d9869ca85a992819df04a0786e9
treea3496bdf9cdc1a261f3762975e8a31af55925f13
parent7e530c13b3ef9b61417a610c00fc1d37c11ff7ed
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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).

1 files changed, 10 insertions(+), 6 deletions(-)

src/glibc.zig+10-6
......@@ -938,7 +938,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
938938 // .globl _Exit_2_2_5
939939 // .type _Exit_2_2_5, %function;
940940 // .symver _Exit_2_2_5, _Exit@@GLIBC_2.2.5
941 // _Exit_2_2_5:
941 // _Exit_2_2_5: .long 0
942942 const ver_index = versions_buffer[ver_buf_i];
943943 const ver = metadata.all_versions[ver_index];
944944
......@@ -960,7 +960,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
960960 \\.globl {s}
961961 \\.type {s}, %function;
962962 \\.symver {s}, {s}{s}GLIBC_{d}.{d}
963 \\{s}:
963 \\{s}: {s} 0
964964 \\
965965 , .{
966966 sym_plus_ver,
......@@ -971,6 +971,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
971971 ver.major,
972972 ver.minor,
973973 sym_plus_ver,
974 wordDirective(target),
974975 });
975976 } else {
976977 const sym_plus_ver = if (want_default)
......@@ -985,7 +986,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
985986 \\.globl {s}
986987 \\.type {s}, %function;
987988 \\.symver {s}, {s}{s}GLIBC_{d}.{d}.{d}
988 \\{s}:
989 \\{s}: {s} 0
989990 \\
990991 , .{
991992 sym_plus_ver,
......@@ -997,6 +998,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
997998 ver.minor,
998999 ver.patch,
9991000 sym_plus_ver,
1001 wordDirective(target),
10001002 });
10011003 }
10021004 }
......@@ -1103,7 +1105,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
11031105 // .type environ_2_2_5, %object;
11041106 // .size environ_2_2_5, 4;
11051107 // .symver environ_2_2_5, environ@@GLIBC_2.2.5
1106 // environ_2_2_5:
1108 // environ_2_2_5: .fill 4, 1, 0
11071109 const ver_index = versions_buffer[ver_buf_i];
11081110 const ver = metadata.all_versions[ver_index];
11091111
......@@ -1126,7 +1128,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
11261128 \\.type {s}, %object;
11271129 \\.size {s}, {d};
11281130 \\.symver {s}, {s}{s}GLIBC_{d}.{d}
1129 \\{s}:
1131 \\{s}: .fill {d}, 1, 0
11301132 \\
11311133 , .{
11321134 sym_plus_ver,
......@@ -1139,6 +1141,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
11391141 ver.major,
11401142 ver.minor,
11411143 sym_plus_ver,
1144 size,
11421145 });
11431146 } else {
11441147 const sym_plus_ver = if (want_default)
......@@ -1154,7 +1157,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
11541157 \\.type {s}, %object;
11551158 \\.size {s}, {d};
11561159 \\.symver {s}, {s}{s}GLIBC_{d}.{d}.{d}
1157 \\{s}:
1160 \\{s}: .fill {d}, 1, 0
11581161 \\
11591162 , .{
11601163 sym_plus_ver,
......@@ -1168,6 +1171,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi
11681171 ver.minor,
11691172 ver.patch,
11701173 sym_plus_ver,
1174 size,
11711175 });
11721176 }
11731177 }