[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs
Itay Bookstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 4 09:09:37 PDT 2021
nextsilicon-itay-bookstein added a comment.
It sort-of-works only because you define the ifunc in both translation units (with the same name). But looks like it behaves incorrectly for references to the ifunc in the translation unit where the resolver is only declared, not defined:
> cat example1.ll
@single_version_ifunc = weak_odr dso_local ifunc void (), void ()* ()* @single_version_resolver
define void ()* @single_version_resolver() {
ret void ()* null
}
define dso_local void @useage() local_unnamed_addr {
entry:
tail call void @single_version_ifunc()
ret void
}
> clang -c example1.ll -o example1.ll.o
> llvm-readobj --relocations example1.ll.o
File: example1.ll.o
Format: elf64-x86-64
Arch: x86_64
AddressSize: 64bit
LoadName: <Not found>
Relocations [
Section (3) .rela.text {
0x11 R_X86_64_PLT32 single_version_ifunc 0xFFFFFFFFFFFFFFFC <-- FINE
}
Section (6) .rela.eh_frame {
0x20 R_X86_64_PC32 .text 0x0
0x34 R_X86_64_PC32 .text 0x10
}
]
> cat example2.ll
@single_version_ifunc = weak_odr dso_local ifunc void (), void ()* ()* @single_version_resolver
declare void ()* @single_version_resolver()
define dso_local void @useage() local_unnamed_addr {
entry:
tail call void @single_version_ifunc()
ret void
}
> clang -c example2.ll -o example2.ll.o
> llvm-readobj --relocations example2.ll.o
File: example2.ll.o
Format: elf64-x86-64
Arch: x86_64
AddressSize: 64bit
LoadName: <Not found>
Relocations [
Section (3) .rela.text {
0x1 R_X86_64_PLT32 single_version_resolver 0xFFFFFFFFFFFFFFFC <-- WHOOPS
}
Section (6) .rela.eh_frame {
0x20 R_X86_64_PC32 .text 0x0
}
]
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112349/new/
https://reviews.llvm.org/D112349
More information about the llvm-commits
mailing list