[lld-macho] Fix left shift of negative value UB

I introduced this mistake in 573c7e6b3c.

Fixes the failure on this UBSan bot:
https://lab.llvm.org/buildbot/#/builders/5/builds/25537
This commit is contained in:
Daniel Bertalan 2022-07-01 11:47:34 +02:00
parent 3a4d9b6a68
commit 73b659ff55

View File

@ -264,7 +264,7 @@ static void writeAdr(void *loc, uint32_t dest, int32_t delta) {
static void writeNop(void *loc) { write32le(loc, 0xd503201f); }
static void writeLiteralLdr(void *loc, Ldr original, int32_t delta) {
uint32_t imm19 = (delta << 3) & 0x00ffffe0;
uint32_t imm19 = (delta & 0x001ffffc) << 3;
uint32_t opcode = 0;
switch (original.size) {
case 4: