[llvm-bugs] [Bug 52378] New: [aarch64-windows] Invalid code generation: wrong immediate value in adrp instruction
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 1 19:56:59 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52378
Bug ID: 52378
Summary: [aarch64-windows] Invalid code generation: wrong
immediate value in adrp instruction
Product: new-bugs
Version: 12.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: roman.zelenyi at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 25414
--> https://bugs.llvm.org/attachment.cgi?id=25414&action=edit
Repro case source code
Switch jump table offset in object file is generated relatively to the
beginning of the code section. If the offset is too big to fit in 21-bit, no
error is reported - the value is just silently stripped of the most significant
bits.
As a result, this adrp instruction in the linked executable contains an invalid
page offset value.
A small buildable repro case has been attached. Here is an excerpt from the
repro.o disassembly:
?same@@YAHH at Z (int __cdecl same(int)):
0000000000200004: 90000209 adrp x9,.text+#0x40 ; <-- wrong offset!
0000000000200008: 2A0003E8 mov w8,w0
000000000020000C: 91010129 add x9,x9,.text+#0x40
0000000000200010: 1000008A adr x10,0000000000200020
0000000000200014: 3868692B ldrb w11,[x9,x8]
0000000000200018: 8B0B094A add x10,x10,x11,lsl #2
000000000020001C: D61F0140 br x10
0000000000200020: 14000000 b ??$int_c@$0A@@@YAHXZ
0000000000200024: 14000000 b ??$int_c@$00@@YAHXZ
0000000000200028: 14000000 b ??$int_c@$01@@YAHXZ
000000000020002C: 14000000 b ??$int_c@$02@@YAHXZ
0000000000200030: 14000000 b ??$int_c@$03@@YAHXZ
0000000000200034: 14000000 b ??$int_c@$04@@YAHXZ
0000000000200038: 14000000 b ??$int_c@$05@@YAHXZ
000000000020003C: 14000000 b ??$int_c@$06@@YAHXZ
0000000000200040: 03020100 ; <-- jump table
0000000000200044: 07060504
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211102/a8c65d58/attachment-0001.html>
More information about the llvm-bugs
mailing list