link/macho: ensure we set alignment of literals to max alignment

This commit is contained in:
Jakub Konka 2024-05-23 10:19:17 +02:00
parent 71bbc5efc9
commit f3a503eca2
2 changed files with 5 additions and 0 deletions

View File

@ -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);

View File

@ -593,6 +593,7 @@ pub fn dedupLiterals(self: Object, lp: MachO.LiteralPool, macho_file: *MachO) vo
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;
}
@ -604,6 +605,7 @@ pub fn dedupLiterals(self: Object, lp: MachO.LiteralPool, macho_file: *MachO) vo
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;
}