-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Include search paths not honored for asm(".include foo.s"); #25185
Comments
assigned to @compnerd |
*** Bug llvm/llvm-bugzilla-archive#26897 has been marked as a duplicate of this bug. *** |
Hmm, this is interesting since this is in the inline assembler. At this point we have already lost the invocation and so we cannot really reconstruct the search path. The alternative way to think about this is what would we do if you constructed a module from clang, and then moved the module and compiled that with llc? I don't know if this is really something we should support. |
I think what it comes down to is that the system assemblers unfortunately take a -I argument, and llvm's integrated assembler is generally supposed to be able to compile the same code that you can with -fno-integrated-as. Your objection appears to be to the entire concept of .include from inline assembly, not just setting the include path. I strongly share that distaste. But, people in the real world do seem to expect it to work, unfortunately. So, IMO, it ought to be supported, even though that does mean being able to push search paths into the integrated assembler, even when compiling from bitcode. |
SVN r291123. |
mentioned in issue llvm/llvm-bugzilla-archive#26897 |
Extended Description
If you write a C file "foo.c" that says:
asm(".include "test-asm.s"");
And have an asm file named "/whatever/test-asm.s".
And if you run:
clang -I /whatever -c foo.c
Then, what should happen:
a) With integrated assembler, the search paths should be used by the integrated assembler to find the file.
b) Without an integrated assembler, the -I path arguments should be passed to the /usr/bin/as program, so it can handle the .include with the right paths. (note: gcc does indeed do this)
What happens now:
It fails to find the test-asm.s file, because search paths aren't passed into either assembler. It can the file (and does include it properly, even!), if the path is specified as relative to your current working directory.
Of course, writing C code like this is INCREDIBLY EVIL and nobody should ever do it. So I'm not planning to fix this. But, having discovered it, I thought I'd at least record a bug.
(Of course if you use this feature, -M can't work, because that stops after preprocessing, and this .include is not processed in the preprocessor. -MD could be made to work, IF you're using the integrated assembler, but that might be a bit of a confusing distinction?)
The text was updated successfully, but these errors were encountered: