-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Don't necessarily enforce file extension of .bc, .ll, .s files #1869
Conversation
IIUC you mean if more than one of Anyway if this is to be merged please also merge |
This will have merge conflicts with #1840 |
Exactly, as the diff clearly shows. Object filenames aren't touched, only bc/ll/s. The point being that we get a single object filename (
Yep, i.e., a single or multiple (-singleobj) D modules compiled to an 'object' (incl. bc/ll/s). In essence, this only affects the output filename of a bc/ll/s file if (1) a single |
Is there a way we can test this? |
I added a tiny test, but opted for a textual IR file and an existence check via FileCheck. |
Use the output filename (-of or inferred) directly if a single file is emitted per compiled module. Fixes issue ldc-developers#1843.
if (global.params.output_bc) | ||
llvm::sys::path::replace_extension(bcpath, global.bc_ext); | ||
std::string bcpath = | ||
(doLTO && outputObj) ? filename : replaceExtensionWith(global.bc_ext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohanEngelen: I guess this fixes a potential issue wrt. -flto=<something> -output-o -output-bc
, as I guess the regular object filename is required for the bitcode file in the LTO case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think with -output-o -output-bc -flto=..
this codeblock should be executed twice. Two files should be output, right? One for -output-o (bitcode because LTO), and one for output-bc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay not outputting the redundant .bc copy in the LTO case for this exotic cmdline-flags constellation.
Cool. |
Use the output filename (-of or inferred) directly if a single file is emitted per compiled module.
Fixes issue #1843.