aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/InternalObject.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-05-23 10:19:17 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-05-23 12:04:17 +0200
commitf3a503eca26e39e7a0870bf02c24b2879ae2cc18 (patch)
tree0f3420c72b041e2e4f886eaf0c50f13a4267059b /src/link/MachO/InternalObject.zig
parent71bbc5efc9c35e4d862dba4f40e5bafe165fcbe4 (diff)
downloadzig-f3a503eca26e39e7a0870bf02c24b2879ae2cc18.tar.gz
zig-f3a503eca26e39e7a0870bf02c24b2879ae2cc18.zip
link/macho: ensure we set alignment of literals to max alignment
Diffstat (limited to 'src/link/MachO/InternalObject.zig')
-rw-r--r--src/link/MachO/InternalObject.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig
index cea32ca233..10f81355f0 100644
--- a/src/link/MachO/InternalObject.zig
+++ b/src/link/MachO/InternalObject.zig
@@ -165,6 +165,7 @@ pub fn dedupLiterals(self: InternalObject, lp: MachO.LiteralPool, macho_file: *M
if (target.getLiteralPoolIndex(macho_file)) |lp_index| {
const lp_atom = lp.getAtom(lp_index, macho_file);
if (target.atom_index != lp_atom.atom_index) {
+ lp_atom.alignment = lp_atom.alignment.max(target.alignment);
target.flags.alive = false;
rel.target = lp_atom.atom_index;
}
@@ -176,6 +177,7 @@ pub fn dedupLiterals(self: InternalObject, lp: MachO.LiteralPool, macho_file: *M
if (target_atom.getLiteralPoolIndex(macho_file)) |lp_index| {
const lp_atom = lp.getAtom(lp_index, macho_file);
if (target_atom.atom_index != lp_atom.atom_index) {
+ lp_atom.alignment = lp_atom.alignment.max(target_atom.alignment);
target_atom.flags.alive = false;
target_sym.atom = lp_atom.atom_index;
}
@@ -193,6 +195,7 @@ pub fn dedupLiterals(self: InternalObject, lp: MachO.LiteralPool, macho_file: *M
if (atom.getLiteralPoolIndex(macho_file)) |lp_index| {
const lp_atom = lp.getAtom(lp_index, macho_file);
if (atom.atom_index != lp_atom.atom_index) {
+ lp_atom.alignment = lp_atom.alignment.max(atom.alignment);
atom.flags.alive = false;
extra.objc_selrefs = lp_atom.atom_index;
sym.setExtra(extra, macho_file);