Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error unknown relocation R_AARCH64_MOVW_UABS_G2 #416

Closed
mcharneyamp opened this issue Apr 4, 2022 · 2 comments
Closed

error unknown relocation R_AARCH64_MOVW_UABS_G2 #416

mcharneyamp opened this issue Apr 4, 2022 · 2 comments

Comments

@mcharneyamp
Copy link

Aarch64. Using gcc 11.2.0 and mold, this example fails to link. It links with default linker.

% gcc -B/usr/local/libexec/mold main.c movzk-reloc.s
mold: error: /tmp/ccN62dh9.o:(.text): unknown relocation: R_AARCH64_MOVW_UABS_G2
collect2: error: ld returned 1 exit status

% cat main.c 
extern void movzk_reloc(void);
int main() {
    movzk_reloc();
}

% cat movzk-reloc.s
.data
.align 8

mydata:
    .space 1024, 0

.text
movzk_reloc:
        stp x15, x16, [sp, #-16]!
        stp x17, x18, [sp, #-16]!

        movz x0, #:abs_g2:mydata
        movk x0, #:abs_g1_nc:mydata
        movk x0, #:abs_g0_nc:mydata

        ldp x17, x18, [sp], #16
        ldp x15, x16, [sp], #16
        ret

.global movzk_reloc

Building mold from git. Tried with tag v1.1.1 and head of main (006b13a 2022-04-04)

Reference: https://sourceware.org/binutils/docs/as/AArch64_002dRelocations.html

@rui314 rui314 closed this as completed in 96a4a1b Apr 5, 2022
@mcharneyamp
Copy link
Author

thanks for the quick fix

@rui314
Copy link
Owner

rui314 commented Apr 5, 2022

No problem. Feel free to report other bugs if you find any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants