* Lookup a label value. */
| 722 | * Lookup a label value. |
| 723 | */ |
| 724 | static off_t lookupLabel(const Binary *B, const char *label, |
| 725 | const Instr *I, intptr_t addr, const LabelSet &labels) |
| 726 | { |
| 727 | if (label[0] != '.' && label[1] != 'L') |
| 728 | error("failed to build trampoline at address 0x%lx; " |
| 729 | "unknown prefix for \"%s\" label", I->addr, label); |
| 730 | |
| 731 | intptr_t target = getBuiltinLabelAddress(B, I, label); |
| 732 | if (target != INTPTR_MIN) |
| 733 | return target - addr; |
| 734 | |
| 735 | // Check for user labels: |
| 736 | Label L(I, label); |
| 737 | auto i = labels.find(L); |
| 738 | if (i == labels.end()) |
| 739 | error("failed to build trampoline at address 0x%lx; " |
| 740 | "unknown label \"%s\"", I->addr, label); |
| 741 | return i->second - addr; |
| 742 | } |
| 743 | |
| 744 | /* |
| 745 | * Build the trampoline bytes. |
no test coverage detected