News for hackers. Stuff that matters.
Re:LLVM 9.0 by saagarjha on Thursday September 19, 2019 @05:09PM (#21020794)
The compiler will surely use a (most likely intrinsic) function with appropriate semantics in that case.
Re:LLVM 9.0 by tedunangst on Thursday September 19, 2019 @05:29PM (#21020932)
The release notes go on to say that you may need to provide your own implementation of bcmp, which does not sound very intrinsic.
Re:LLVM 9.0 by saagarjha on Thursday September 19, 2019 @05:44PM (#21021034)
Huh, interesting. I was assuming that the compiler would statically link in a bcmp in that case, but it looks like it will literally replace it with a call to bcmp in certain cases (as defined by the remainder of that point in the release notes). Apparently this was brought up and brushed aside as not an issue: https://bugs.llvm.org/show_bug.cgi?id=41035
Re:LLVM 9.0 by Someone on Friday September 20, 2019 @09:26AM (#21026413)
You may if you’re building freestanding code (code that doesn’t use the standard library), but do not specify that you are. I think that’s reasonable.

I do wonder why this is a LLVM feature, though, and not a clang one. The system should only make this change if it came from a C(++) compiler and the source included the system header (<string.h> or <cstring>) to get memcmp.

How can LLVM know that the symbol memcmp it sees came from that header, and not from user C code that may do something different, or even from, say, a Cobol compiler?