Skip to content

No relocation are emitted for pointer on weak function for arm #112340

Open
@Ralender

Description

@Ralender

Make file with the following named tmp.c

int __attribute__((weak)) foo() { return 9; }

typedef int (*func_ptr)();

func_ptr get() { return &foo; }

run:

clang -target arm-none-linux-android tmp.c -c -o out.o
llvm-objdump -r out.o

The function pointer in get may get overridden by the foo from an other TU.
So the compiler needs to generate a relocation. but in this case it doesn't.

Maybe the problem is simply that foo is emitted with dso_local.
Note that other backends(X86, aarch64) still generate relocations even with the dso_local.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions