Skip to content

Commit d7c3926

Browse files
authored
Fix armv7l compilation (#30253)
* src/task.c: Use `bx` instead of `br` instruction on armv7l * Fix typo and incorrect initialization within `jl_getauxval` on armv7l.
1 parent a0bc8fd commit d7c3926

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/processor_arm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ static inline unsigned long jl_getauxval(unsigned long type)
522522
{
523523
// First, try resolving getauxval in libc
524524
auto libc = jl_dlopen(nullptr, JL_RTLD_LOCAL);
525-
static (unsigned long (*)(unsigned long) getauxval_p;
526-
if (jl_dlsym(libc, "getauxval", &getauxval_p, 0) {
525+
static unsigned long (*getauxval_p)(unsigned long) = NULL;
526+
if (getauxval_p == NULL && jl_dlsym(libc, "getauxval", (void **)&getauxval_p, 0)) {
527527
return getauxval_p(type);
528528
}
529529

src/task.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,9 @@ static void jl_start_fiber(jl_ucontext_t *lastt, jl_ucontext_t *t)
762762
asm(" mov sp, %0;\n"
763763
" mov lr, #0;\n" // Clear link register (lr) and frame pointer
764764
" mov fp, #0;\n" // (fp) to terminate unwinder.
765-
" br %1;\n" // call `fn` with fake stack frame
765+
" bx %1;\n" // call `fn` with fake stack frame. While `bx` can change
766+
// the processor mode to thumb, this will never happen
767+
// because all our addresses are word-aligned.
766768
" udf #0" // abort
767769
: : "r" (stk), "r"(fn) : "memory" );
768770
#else

0 commit comments

Comments
 (0)