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

Darwin -fsanitize=cfi -flto=thin causes raw bitcode to be emitted, instead of Mach-O-wrapped bitcode #32088

Open
ahmedbougacha opened this issue Apr 22, 2017 · 2 comments
Labels
bugzilla Issues migrated from bugzilla

Comments

@ahmedbougacha
Copy link
Member

Bugzilla Link 32741
Version unspecified
OS All
CC @pcc

Extended Description

r301016 enabled CFI tests using ThinLTO on Darwin, but those are failing:

ld: warning: ignoring file /var/folders/09/r4vw4v8n5kb67jl66zvlbljw0000gn/T/lit_tmp_j2NEGY/nvcall-1477f4.o, file was built for unsupported file format ( 0x42 0x43 0xC0 0xDE 0x35 0x14 0x00 0x00 0x05 0x00 0x00 0x00 0x62 0x0C 0x30 0x24 ) which is not the architecture being linked (x86_64): /var/folders/09/r4vw4v8n5kb67jl66zvlbljw0000gn/T/lit_tmp_j2NEGY/nvcall-1477f4.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

http://green.lab.llvm.org/green/job/clang-stage1-configure-RA_check/30480/consoleFull#-121919748349ba4694-19c4-4d7e-bec5-911270d8a58c

It seems that -fsanitize=cfi somehow causes -flto=thin to emit bitcode instead of mach-o:

$ ./bin/clang -flto=thin -fvisibility=hidden -fsanitize=cfi /tmp/t.cpp -c && file t.o
t.o: LLVM IR bitcode
$ ./bin/clang -flto=thin -fvisibility=hidden /tmp/t.cpp -c && file t.o
t.o: LLVM bitcode, wrapper x86_64

And it seems that ld64 doesn't accept raw bitcode.

@pcc
Copy link
Contributor

pcc commented Apr 22, 2017

This has no hope of working until ld64 is changed to use the resolution-based LTO API. Until then, we will need to change the clang driver to prevent the use of -flto=thin with -fsanitize=cfi (and -fwhole-program-vtables).

@pcc
Copy link
Contributor

pcc commented Apr 22, 2017

...on Darwin.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants