For x86 architectures, binutils objcopy and strip can be used as
such.
For armv7 and aarch64, binutils doesn't recognize the architectures
and refuse to touch the files. For most/everything that objcopy/strip
do, the actual architecture doesn't really matter though. Therefore,
provide a wrapper script and a minimal tool for editing PE executables,
that change the architecture from armv7 and aarch64 to i686 and x86_64
respectively before invoking binutils, and change it back afterwards.
In case the binutils tools are missing, just return a successful result
without doing anything for stripping operations (previously, we had the
<triplet>-strip tool symlinked to /bin/true, so this isn't any worse than
before) and fail for other objcopy operations.
This allows using GNU binutils strip and objcopy on executables with
dwarf debug info linked by lld.
This also improves clang's handling of detecting known libraries
that override default libraries to link.
This version includes the windows api sets version of the universal
crt, fixes a few other functions when used with the universal crt,
and fixes the widl tool when running on macos.
If installing on top of a prebuilt win32 release of llvm instead of
building from source, the nm and strings executables are missing,
and MSYS2 errors out when creating a symlink to a file that doesn't
exist (since it does a copy instead of making an actual symlink).
This fixes an issue with code generation for functions that needed
a stack probe on armv7, improves llvm-rc and adds a few more options
to the mingw lld frontend.
This fixes building resource files that refer to external files
relative to the source directory, without specifying any directory
via include flags to windres itself. This is needed since llvm-rc
doesn't see the original source file but only sees the preprocessed
one in a temporary directory.
Alternatively, the preprocessed file could be placed in the same
directory as the source file, but when building e.g. outside of the
source tree, writing files (even temporary ones) inside the source
tree isn't generally expected.
This version improves llvm-rc to support more rc script features
and features built-in filtering of CPP output in llvm-rc. It also
improves the handling of some def features in llvm-dlltool, allows
producing codeview debug information when targeting mingw and adds
handling of a few more ARM64 relocations in lld.
This avoids needing the clang++ symlink. On platforms without symlinks
(i.e. windows), clang.exe and clang++.exe are two separate but identical
executables. This allows getting rid of the latter, saving size.
When building libcxx, this is also already enabled via the cmake
option -DLIBCXX_HAS_WIN32_THREAD_API=ON.
This fixes building libcxxabi if pthreads are available.
In this version, the binary actually is named clang-7 instead of
clang-7.0. This requires extending the test a little for keeping such
binaries but removing other clang-foo tools.
gcc/libssp's configure script runs checks for flags that clang doesn't
implement. We actually just need to set a few HAVE defines and compile
the .c sources, so just check out this subdirectory using svn and build
it using a custom makefile.
As long as we pass --sysroot explicitly in clang-target-wrapper.sh,
this isn't necessary. And since clang SVN r329946. it's no longer
necessary when not specifying the sysroot (and having it is in
fact harmful).
This doesn't help reduce the docker image size since it's done
in a separate RUN step than the one that added the files. (compiler-rt
and libunwind currently fail to build after stripping the llvm
installation though.)
This version fixes issues with long double math functions on x86_64
(and some mingw-w64 float/double math functions are implemented with
a long double function internally), and adds support for the --kill-at
flag in lld.
This fixes issues with -mms-bitfields together with "long double"
on i686, and allows using the -static flag while building DLLs
(to link dependent libraries statically), and implements stack
probing for alloca calls on aarch64.
This avoids touching the target file if the new file to install
matches the previous one. This avoids rebuilding other files later
needlessly, when upgrading an installation.
This makes the output architecture independent, allowing
the x86_64 GNU binutils binary to be used for other
architectures as well, including arm/arm64 which aren't supported
by binutils.
LLVM does have llvm-rc, which almost does what is needed.
Currently missing features:
- It doesn't run the C preprocessor (which can be wrapped with
a shellscript easily if necessary)
- It chokes on C structs/typedefs normally found in included
C headers
Provide wrappers named <triplet>-gcc and <triplet>-g++ as well,
to ease cross compilation with e.g. autotools, to allow just
specifying --host=<triplet>.
Provide wrappers for objdump and ld that provide specific output
that autotools look for.
Provide <triplet>-strip as a symlink to /bin/true, since there is
no strip tool available yet (and llvm-objcopy doesn't support
COFF yet).