| ... | ... | @@ -1113,6 +1113,7 @@ const x86_64 = struct { |
| 1113 | 1113 | code: ?[]const u8, |
| 1114 | 1114 | it: *RelocsIterator, |
| 1115 | 1115 | ) !void { |
| 1116 | dev.check(.x86_64_backend); |
| 1116 | 1117 | const is_static = elf_file.base.isStatic(); |
| 1117 | 1118 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| 1118 | 1119 | |
| ... | ... | @@ -1235,6 +1236,7 @@ const x86_64 = struct { |
| 1235 | 1236 | code: []u8, |
| 1236 | 1237 | stream: anytype, |
| 1237 | 1238 | ) (error{ InvalidInstruction, CannotEncode } || RelocError)!void { |
| 1239 | dev.check(.x86_64_backend); |
| 1238 | 1240 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); |
| 1239 | 1241 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1240 | 1242 | |
| ... | ... | @@ -1380,6 +1382,7 @@ const x86_64 = struct { |
| 1380 | 1382 | code: []u8, |
| 1381 | 1383 | stream: anytype, |
| 1382 | 1384 | ) !void { |
| 1385 | dev.check(.x86_64_backend); |
| 1383 | 1386 | _ = code; |
| 1384 | 1387 | _ = it; |
| 1385 | 1388 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); |
| ... | ... | @@ -1420,6 +1423,7 @@ const x86_64 = struct { |
| 1420 | 1423 | } |
| 1421 | 1424 | |
| 1422 | 1425 | fn relaxGotpcrelx(code: []u8) !void { |
| 1426 | dev.check(.x86_64_backend); |
| 1423 | 1427 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1424 | 1428 | const inst = switch (old_inst.encoding.mnemonic) { |
| 1425 | 1429 | .call => try Instruction.new(old_inst.prefix, .call, &.{ |
| ... | ... | @@ -1438,6 +1442,7 @@ const x86_64 = struct { |
| 1438 | 1442 | } |
| 1439 | 1443 | |
| 1440 | 1444 | fn relaxRexGotpcrelx(code: []u8) !void { |
| 1445 | dev.check(.x86_64_backend); |
| 1441 | 1446 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1442 | 1447 | switch (old_inst.encoding.mnemonic) { |
| 1443 | 1448 | .mov => { |
| ... | ... | @@ -1456,6 +1461,7 @@ const x86_64 = struct { |
| 1456 | 1461 | elf_file: *Elf, |
| 1457 | 1462 | stream: anytype, |
| 1458 | 1463 | ) !void { |
| 1464 | dev.check(.x86_64_backend); |
| 1459 | 1465 | assert(rels.len == 2); |
| 1460 | 1466 | const writer = stream.writer(); |
| 1461 | 1467 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); |
| ... | ... | @@ -1495,6 +1501,7 @@ const x86_64 = struct { |
| 1495 | 1501 | elf_file: *Elf, |
| 1496 | 1502 | stream: anytype, |
| 1497 | 1503 | ) !void { |
| 1504 | dev.check(.x86_64_backend); |
| 1498 | 1505 | assert(rels.len == 2); |
| 1499 | 1506 | const writer = stream.writer(); |
| 1500 | 1507 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); |
| ... | ... | @@ -1543,6 +1550,7 @@ const x86_64 = struct { |
| 1543 | 1550 | } |
| 1544 | 1551 | |
| 1545 | 1552 | fn canRelaxGotTpOff(code: []const u8) bool { |
| 1553 | dev.check(.x86_64_backend); |
| 1546 | 1554 | const old_inst = disassemble(code) orelse return false; |
| 1547 | 1555 | switch (old_inst.encoding.mnemonic) { |
| 1548 | 1556 | .mov => if (Instruction.new(old_inst.prefix, .mov, &.{ |
| ... | ... | @@ -1558,6 +1566,7 @@ const x86_64 = struct { |
| 1558 | 1566 | } |
| 1559 | 1567 | |
| 1560 | 1568 | fn relaxGotTpOff(code: []u8) void { |
| 1569 | dev.check(.x86_64_backend); |
| 1561 | 1570 | const old_inst = disassemble(code) orelse unreachable; |
| 1562 | 1571 | switch (old_inst.encoding.mnemonic) { |
| 1563 | 1572 | .mov => { |
| ... | ... | @@ -1574,6 +1583,7 @@ const x86_64 = struct { |
| 1574 | 1583 | } |
| 1575 | 1584 | |
| 1576 | 1585 | fn relaxGotPcTlsDesc(code: []u8) !void { |
| 1586 | dev.check(.x86_64_backend); |
| 1577 | 1587 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1578 | 1588 | switch (old_inst.encoding.mnemonic) { |
| 1579 | 1589 | .lea => { |
| ... | ... | @@ -1596,6 +1606,7 @@ const x86_64 = struct { |
| 1596 | 1606 | elf_file: *Elf, |
| 1597 | 1607 | stream: anytype, |
| 1598 | 1608 | ) !void { |
| 1609 | dev.check(.x86_64_backend); |
| 1599 | 1610 | assert(rels.len == 2); |
| 1600 | 1611 | const writer = stream.writer(); |
| 1601 | 1612 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); |
| ... | ... | @@ -2312,3 +2323,4 @@ const File = @import("file.zig").File; |
| 2312 | 2323 | const Object = @import("Object.zig"); |
| 2313 | 2324 | const Symbol = @import("Symbol.zig"); |
| 2314 | 2325 | const Thunk = @import("thunks.zig").Thunk; |
| 2326 | const dev = @import("../../dev.zig"); |