Use llvm 3.3 bitcode on LLVM 3.6 Static Pass - clang

Right now, I have an llvm bitcode compatible with llvm 3.3. However, my LLVM static pass is using llvm 3.6. Since the format of bitcode changes from 3.3 to 3.6, the pass is having issues on extracting debugging metadata.
One way to solve this is that I could downgrade my whole llvm 3.6 pass to 3.3. However, is there any other way of doing this?

Related

Is libc++ backward compatible with older versions?

I'm running Ubuntu 20.04 and I have installed libc++-dev (and ABI) package which is libc++-6.0-2.
However, now I have to use CLang 11, which requires a newer version of libc++ for better support to C++17, so I need to install libc++-11-dev, which is a different package and will replace my older.
My question is, how do I know if libc++ is backward compatible? I have hundreds of projects built and I don't want to rebuild all again.
I can't find a clear information about it in libcxx-11 documentation.
Yes. Newer versions of the libc++ dylib have new features, but it is intended that the dylib is compatible going forward.

Compiling C Source for iOS

I have some existing source code that is written in C that I want to build and include in my iOS project. The entire source package is very large and is built using existing Makefiles and GCC. It is producing static libraries (.a files) that I would love to move over to my iOS project. However, the static libraries the Makefile produces is for x86 processors, which obviously won't work on iOS.
Is there a way I can switch GCC to build for ARMv7/ARM64 instead, without making changes to the existing source (in most cases)? I know there is the -march switch for GCC or you can download ARM specific GCC compilers, so I know the general concept of building for a different architecture than the build machine.
To build for ARM on Mac OS, will I have to download a different GCC compiler or is that capability built into the default GCC?
I'm sorry for the lack of understanding of basic concepts here; I'm primarily a Java and Objective-C developer, so building source for different architectures is a mostly foreign concept to me.
Whilst GCC supports a good many CPU architecture and platforms, it is usually built for a single one. To compile for ARM you generally need an ARM-cross-compiling GCC targeted appropriately.
The default system compiler for MacOSX and iOS for all architectures is clang and has been for some time (the last version of GCC apple shipped in dev tools is creaking and obsolete, and definitely won't support ARMv8).
The usual way of getting clang is to install Xcode (free from the App Store). There's a option in the installer (and in the UI of Xcode) to install the command-line tool package. This installs sym-links in /usr/bin to the compiler, and installs a bunch of other stuff you might expect such as make.
clang is (mostly) command-line compatible with gcc, and furthermore, you'll find that if you run gcc from the command-line on a Mac with dev-tools installed, you in fact get clang.
$ gcc --version
Configured with: -- prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
clang comes with ARMv7, ARMv8, i686, x86_64 on MacOSX, and can be configured to compile for any of these from the command line (See documentation)
Given the above, there's a fair chance your code will compile with minimal changes to compiler-flags using the existing makefile. You might want to read the documentation for lipo - which allows you to produce multi-architecture binaries.

clang-3.4 binary for mingw32

I was wondering if there is a pre-built clang-3.4 (stable-release) binary for mingw32 (www.mingw.org) for download? I do not want to use the VS version b/c I only use gcc and I don't want future compatibility issues (such as VS compiled opencv shared libraries crashing mingw/gcc compiled applications).
I checked http://llvm.org/releases/download.html. They had "Experimental Clang Binaries for Mingw32/x86" for 3.3 and 3.2, but not for the new 3.4 release.
Thanks,

Building Clang, libstdc++4.6 to libstdc++4.7

I am trying to build Clang following this: http://clang.llvm.org/get_started.html
At step 6 the command ../llvm/configure runs a series of checks and one tells me:
checking whether Clang will select a modern C++ standard library... no
configure: error:
We detected a missing feature in the standard C++ library that was known to be
missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous
C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older
than 4.7. You will need to update your system and ensure Clang uses the newer
standard library.
If this error is incorrect or you need to force things to work, you may pass
'--disable-compiler-version-checks' to configure to bypass this test.
I don't know how to resolve this and google searches for libstdc++4.7 did not produce anything useful to me or something I understand. How do I go about replacing / upgrading this? I am on a Mac (10.7.5)
I ran into the same problem. The easiest way to build Clang is to use libc++ instead of libstdc++. If you don't have libc++, you can obtain it by installing XCode 4.2 (or newer) or you can build it yourself by following the instructions here: http://libcxx.llvm.org/
After you have libc++ installed, you can use the --enable-libcpp=yes flag with the configure command.
Just this week, the LLVM & Clang project upped the minimal compiler version requirement to gcc 4.7, with its libstdc++. You'll need to install or build a newer gcc.
Here's a blog post I wrote earlier today about building gcc 4.8 on Ubuntu 12.04 and using that to compile trunk LLVM & Clang. Hope this helps!
i have the same error on mac 10.8.5 xcode 5.0
configure option --enable-libcpp resolve my problem
../llvm/configure --enable-cxx11 --enable-optimized --enable-libcpp
For me this happened because I had the old clang and clang++ that I'd previously built from source (the one I was attempting to build to replace) coming first in my PATH. These were too old. Removing those two files so that the build process would use the clang and clang++ that comes with XCode's Command Line Tools and then rebuilding worked fine.

Error compiling NEON for iOS 5.1 with clang integrated assembler

I try to compile NEON assembly code with LLVM clang integrated macro assembler (the LLVM compiler shipped with XCode 4.3) and get the following error:
vld1.8 {D0}, [R0] - invalid operand for instruction
What can be the reason? Why this instruction is successfuly compiled by GAS for Android and can't be compiled by 'clang -integrated-as ...' for iOS? Thanks.
After a day of experimenting I've found a solution. I've just compiled LLVM from the SVN source base (version 3.2). The integrated macro assembler in LLVM 3.2svn supports ARM NEON ISA much better compared to LLVM 3.0svn shipped with XCode 4.3.1. The problem with VLD NEON instruction have been automatically resolved.
Those, who use gas-preprocessor.pl Perl script, may try to switch from GAS 1.38 (it's external GNU assembler used by LLVM on Mac OS X 10.7.X) to LLVM integrated macro assembler and stop using unnecessary preprocessing.
I've not used clang for assembly but the following site might help: ARM Assembly
In addition, this may help as it solved someone else's issue with ARM assembly (selecting the correct device, lower case instructions etc...): Useful Stackoverflow answer

Resources