asm: make all text section labels .L local

To help with backtraces if we ever fix them due to the lkmc_asm_main_after_prologue debacle.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-16 00:00:01 +00:00
parent 4d4b82f248
commit b3874cc72b
14 changed files with 43 additions and 46 deletions

View File

@@ -16,6 +16,5 @@ LKMC_PROLOGUE
*/
adr x0, data_label
ldr x1, =data_label
label:
LKMC_ASSERT_EQ_REG(x0, x1)
LKMC_EPILOGUE

View File

@@ -3,9 +3,9 @@
#include <lkmc.h>
LKMC_PROLOGUE
adrp x0, label
adr x1, label
label:
adrp x0, .Llabel
adr x1, .Llabel
.Llabel:
/* Clear the lower 12 bits. */
bic x1, x1, 0xFF
bic x1, x1, 0xF00

View File

@@ -6,14 +6,13 @@ LKMC_PROLOGUE
/* Branch. */
mov x0, 0x0
cbz x0, ok
cbz x0, .Lok
LKMC_ASSERT_FAIL
ok:
.Lok:
/* Don't branch. */
mov x0, 0x1
cbz x0, ko
cbz x0, .Lko
LKMC_EPILOGUE
ko:
.Lko:
LKMC_ASSERT_FAIL

View File

@@ -17,10 +17,10 @@ LKMC_PROLOGUE
* This could be used if the label is too far away for
* adr relative addressing.
*/
movz x0, :abs_g2:label /* bits 32-47, overflow check */
movk x0, :abs_g1_nc:label /* bits 16-31, no overflow check */
movk x0, :abs_g0_nc:label /* bits 0-15, no overflow check */
adr x1, label
label:
movz x0, :abs_g2:.Llabel /* bits 32-47, overflow check */
movk x0, :abs_g1_nc:.Llabel /* bits 16-31, no overflow check */
movk x0, :abs_g0_nc:.Llabel /* bits 0-15, no overflow check */
adr x1, .Llabel
.Llabel:
LKMC_ASSERT_EQ_REG(x0, x1)
LKMC_EPILOGUE

View File

@@ -27,11 +27,11 @@ LKMC_PROLOGUE
* "LDR (literal)" instead of "LDR (immediate)":
* https://stackoverflow.com/questions/28638981/howto-write-pc-relative-adressing-on-arm-asm/54480999#54480999
*/
ldr x0, pc_relative_ldr
b 1f
pc_relative_ldr:
ldr x0, .Lpc_relative_ldr
b 2f
.Lpc_relative_ldr:
.quad 0x123456789ABCDEF0
1:
2:
LKMC_ASSERT_EQ(x0, =0x123456789ABCDEF0)
/* Just for fun, we can also use relative numbers instead of labels.
@@ -68,7 +68,7 @@ pc_relative_ldr:
ldr x0, pc_relative_str
LKMC_ASSERT_EQ(x0, =0x0)
adr x1, pc_relative_str
ldr x0, pc_relative_ldr
ldr x0, .Lpc_relative_ldr
str x0, [x1]
ldr x0, pc_relative_str
LKMC_ASSERT_EQ(x0, =0x123456789ABCDEF0)