-
Notifications
You must be signed in to change notification settings - Fork 449
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
Xcode4, libtomcrypt, LLVM, asm (unknown version of libtomcrypt) #2
Comments
|
as far as I can see you're using 1.16 |
|
I wasn't the one that made those attribute changes. Still...good to see that there's something. Does the latest version use those attributes as well? |
|
I am presently attempting to get Stempania 3.9 to build on Lion (which is more of a challenge, I suspect) and am seeing this error. Though extra bizarrely I seem to only see it when I execute the build from the XCode GUI. If I use xcodebuild from the command line it seems to build cleanly (though I haven't gotten the rest to build enough to have any hope of testing linking yet). |
|
It seems like the difference, at least for 3.9 may be that the GUI seems to be hitting the "Debug" configuration, whereas xcodebuild is using the "Native" configuration. I have't looked into it deeper than that. |
|
I ran into this issue as well. The workaround I ended up doing was to add I think the issue is that the
I believe the intent is for something like However, if the function doesn't get inlined, or the compiler doesn't optimize (i) to a literal constant as a result of inlining, then the constraint It sounds like someone tried to address this issue in your codebase by forcing the compiler to always inline. Unfortunately this won't work if the attribute gets ignored, or if the compiler doesn't do the further optimization of replacing I think that the most portable fix would be to make |
|
I thought I'd go ahead and give a quick try for redefining We also need to copy the parameter to avoid changing its value and to handle the case where the parameter isn't an lvalue. Anyways, the following compiles, but I haven't tested for correctness: |
|
how about using the old trick: do { code_here(); } while(0) |
That trick only works to replace a function that returns void. This one needs to return the rotated value. Here's an example call site from aes.c: (edited for clarification) |
|
Incidentally, I think the reason I'm hitting this bug is because I'm compiling with -O0, causing gcc to skip the inlining. I'm including tomcrypt as part of a larger project build, from which the tomcrypt build inherits some CFLAGS. i.e., the bug can be replicated with gcc on the stock code base by: |
|
@sporksmith did you try to define the function with |
|
I don't remember whether we tried We ended up solving it by just not having the tomcrypt build inherit the |
|
Proposed solution in this pull request |
|
pull/125 was closed, can we also close this issue? |
Good insert time zone here everyone. I represent the StepMania 5/StepMania sm-ssc group from Google Code, and I am trying to work on bringing our project up to date for Xcode 4 on the Mac OS X side. Our project uses libtommath and libtomcrypt. Unfortunately, I do not know what version it is, which makes this issue a little hard to figure out.
The old environment we used, Xcode 3, used GCC 4.0 for historical reasons. With the move to Xcode 4, we wish to take advantage of a faster, better compiler: specifically, LLVM 2.0 (also known as Clang). Unfortunately, that better, faster compiler is not working due to this one small issue.
In
tomcrypt_macros.h, there are two sets of ROLc and RORc static inline functions that both contain asm code. The core part of one of them is as follows:The compiler complains on aes.c, md5.c, and sha1.c of this message:
fatal error: error in backend: Invalid operand for inline asm constraint 'I'!That function, and three others just like it, are the only occasions where there is the 'I' constraint.
If we try to use GCC 4.2 for libtomcrypt and Clang for the rest of our libraries (including libtommath), this eventually comes up on linking.
I admit I am at a loss as to how to properly solve this.
The code we use for libtomcrypt is included in our repository (Mercurial required). We haven't moved it to our externs yet, so it's located in
src/libtomcrypt/src. The spcific branch that I am trying to make work is theXCode4branch, but I believe any attempts at compiling libtomcrypt via Clang will fail, not just my end. If requested, I will upload just the libtomcrypt part at the location of your choice.Jason "Wolfman2000" Felds
The text was updated successfully, but these errors were encountered: