| author | |
| committer | |
| log | 762ad4c6f49dfa1b8893353fb099d4e93672733f |
| tree | e11ca84a1fb30710f592358a00d3c74cc197c1fc |
| parent | ef72b91ac2b96ba64a53b08a661e9ad83a828ee4 |
| signature |
max(user_align, minFunctionAlignment()) is only appropriate when the user has
actually given an explicit, non-zero alignment value.3 files changed, 15 insertions(+), 9 deletions(-)
src/link/Coff.zig+5-3| ... | @@ -1391,9 +1391,11 @@ fn updateNavCode( | ... | @@ -1391,9 +1391,11 @@ fn updateNavCode( |
| 1391 | 1391 | ||
| 1392 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); | 1392 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); |
| 1393 | 1393 | ||
| 1394 | const required_alignment = pt.navAlignment(nav_index).max( | 1394 | const target = zcu.navFileScope(nav_index).mod.resolved_target.result; |
| 1395 | target_util.minFunctionAlignment(zcu.navFileScope(nav_index).mod.resolved_target.result), | 1395 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 1396 | ); | 1396 | .none => target_util.defaultFunctionAlignment(target), |
| 1397 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), | ||
| 1398 | }; | ||
| 1397 | 1399 | ||
| 1398 | const nav_metadata = self.navs.get(nav_index).?; | 1400 | const nav_metadata = self.navs.get(nav_index).?; |
| 1399 | const atom_index = nav_metadata.atom; | 1401 | const atom_index = nav_metadata.atom; |
src/link/Elf/ZigObject.zig+5-3| ... | @@ -1277,9 +1277,11 @@ fn updateNavCode( | ... | @@ -1277,9 +1277,11 @@ fn updateNavCode( |
| 1277 | 1277 | ||
| 1278 | log.debug("updateNavCode {}({d})", .{ nav.fqn.fmt(ip), nav_index }); | 1278 | log.debug("updateNavCode {}({d})", .{ nav.fqn.fmt(ip), nav_index }); |
| 1279 | 1279 | ||
| 1280 | const required_alignment = pt.navAlignment(nav_index).max( | 1280 | const target = zcu.navFileScope(nav_index).mod.resolved_target.result; |
| 1281 | target_util.minFunctionAlignment(zcu.navFileScope(nav_index).mod.resolved_target.result), | 1281 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 1282 | ); | 1282 | .none => target_util.defaultFunctionAlignment(target), |
| 1283 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), | ||
| 1284 | }; | ||
| 1283 | 1285 | ||
| 1284 | const sym = self.symbol(sym_index); | 1286 | const sym = self.symbol(sym_index); |
| 1285 | const esym = &self.symtab.items(.elf_sym)[sym.esym_index]; | 1287 | const esym = &self.symtab.items(.elf_sym)[sym.esym_index]; |
src/link/MachO/ZigObject.zig+5-3| ... | @@ -962,9 +962,11 @@ fn updateNavCode( | ... | @@ -962,9 +962,11 @@ fn updateNavCode( |
| 962 | 962 | ||
| 963 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); | 963 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); |
| 964 | 964 | ||
| 965 | const required_alignment = pt.navAlignment(nav_index).max( | 965 | const target = zcu.navFileScope(nav_index).mod.resolved_target.result; |
| 966 | target_util.minFunctionAlignment(zcu.navFileScope(nav_index).mod.resolved_target.result), | 966 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 967 | ); | 967 | .none => target_util.defaultFunctionAlignment(target), |
| 968 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), | ||
| 969 | }; | ||
| 968 | 970 | ||
| 969 | const sect = &macho_file.sections.items(.header)[sect_index]; | 971 | const sect = &macho_file.sections.items(.header)[sect_index]; |
| 970 | const sym = &self.symbols.items[sym_index]; | 972 | const sym = &self.symbols.items[sym_index]; |