Commit Graph

155 Commits

Author SHA1 Message Date
Thomas Pöchtrager
320e0b0295 Silence warning 2020-03-20 16:28:29 +01:00
Thomas Pöchtrager
80a127f521 Attempt to fix build error 2020-03-20 13:51:18 +01:00
Thomas Pöchtrager
466063c7f7 ld64 512.4 & cctools 949.0.1 (WIP) 2020-03-20 13:33:04 +01:00
Thomas Pöchtrager
606eb7dcb2 Fix for https://github.com/tpoechtrager/osxcross/issues/216#issuecomment-599044727 2020-03-14 17:51:11 +01:00
Thomas Pöchtrager
4e1faecce8 Fix LLVM trunk build
ld: error: duplicate symbol: dis_info
>>> defined at i386_disasm.c:1665
>>>            otool-i386_disasm.o:(dis_info)
>>> defined at arm_disasm.c:163
>>>            otool-arm_disasm.o:(.bss+0x8)

ld: error: duplicate symbol: dis_info
>>> defined at i386_disasm.c:1665
>>>            otool-i386_disasm.o:(dis_info)
>>> defined at arm64_disasm.c:62
>>>            otool-arm64_disasm.o:(.bss+0x0)
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
2020-03-11 19:49:44 +01:00
Thomas Pöchtrager
2ac55b7503 Silence warning on AArch64 too
Useless warning because it's silenced by default on all of their platforms
2020-02-22 22:13:44 +01:00
Thomas Pöchtrager
ae83e7fcde Fix for #74 2020-01-23 14:30:08 +01:00
Thomas Pöchtrager
707ac80aa8 arm64e: Patch the header file instead of changing sources to avoid merge conflicts 2020-01-07 16:22:22 +01:00
Sam Bingner
7c5dc14232 Add arm64e patches from elucubratus 2020-01-06 16:37:23 -10:00
Thomas Pöchtrager
f2890afb8a Fix LLVM trunk build 2019-12-29 20:44:50 +01:00
Thomas Pöchtrager
8239a5211b Add another missing change for Android 2019-11-06 18:21:03 +01:00
Thomas Pöchtrager
9fa76fb95a Add missing file 2019-11-06 17:56:26 +01:00
Thomas Pöchtrager
5e9c52005f Fixes to make cctools and ld64 work on Android 2019-11-06 17:54:58 +01:00
Thomas Pöchtrager
406ce466ac Fix building with older clang compilers 2019-11-04 20:25:36 +01:00
Thomas Pöchtrager
a889ea66b7 Fix Linux/AArch32 and iOS builds 2019-11-01 18:45:25 +01:00
Thomas Pöchtrager
bef74700f8 Revert "Make 'as' relocatable"
This reverts commit 5674c31aac.

I accidentally committed this again...
2019-10-31 20:29:29 +01:00
Thomas Pöchtrager
cfc428bc52 Update autogenerated files 2019-10-31 20:07:19 +01:00
Thomas Pöchtrager
a4f3a3e0ea ld64 450.3 & cctools 927.0.2 2019-10-31 20:06:41 +01:00
Thomas Pöchtrager
3764b223c0 Fix glibc sys/sysctl.h deprecation warnings 2019-10-07 15:18:32 +02:00
Thomas Pöchtrager
8b155ce07e Revert "Revert "Make 'as' relocatable""
This reverts commit 8bd2c684ac.
2019-08-19 19:28:30 +02:00
Thomas Pöchtrager
8bd2c684ac Revert "Make 'as' relocatable"
This reverts commit 5674c31aac.

https://github.com/tpoechtrager/osxcross/issues/191
2019-08-19 19:24:29 +02:00
Thomas Pöchtrager
5674c31aac Make 'as' relocatable 2019-08-17 11:48:05 +02:00
Nathan Froyd
3d4795134b fix atom alias information in LTO linking
When performing LTO, `ld64` reads in any LLVM bitcode files, creates
atoms for them, and compiles the bitcode files to their corresponding
in-memory Mach-O files.  These Mach-O files are then
loaded (lto_file.cpp:Parser::loadMachO), and information from the atoms
in the Mach-O files is then synced to the corresponding atoms from the
LLVM bitcode files.

However, the underlying function (ld.hpp:Atom::setAttributesFromAtom)
fails to copy over the alias bit from the Mach-O symbol.  This omission
means that the original LLVM atom is not correctly marked as an alias
and therefore not correctly sorted prior to the symbol it is an alias
for (order.cpp:Layout::Comparer::operator()).  The end result is that
the alias symbol winds up pointing at a different symbol, with
predictably disastrous consequences when the aliased symbol is called.

This problem has been observed when performing cross-language LTO with
Firefox.  See also
https://bugzilla.mozilla.org/show_bug.cgi?id=1486042#c92 for more
details.

The fix is simple: we need to copy the alias bit over, just like other
fields.
2019-07-02 12:08:12 -04:00
Thomas Pöchtrager
a2e02aad90 Update autogenerated files 2019-06-04 18:20:13 +02:00
Thomas Pöchtrager
4d099de815 Add --with-libxar=<path> configure option 2019-06-04 18:18:52 +02:00
Thomas Pöchtrager
7731c655fd Fix ARM and AArch64 build 2019-06-02 17:48:09 +02:00
Thomas Pöchtrager
f22b786968 Fix FreeBSD build 2019-06-02 14:28:21 +02:00
Thomas Pöchtrager
da74096c93 ld64: Fix finding object files without TAPI library 2019-06-01 20:53:55 +02:00
Thomas Pöchtrager
634c77e4f1 Misc fixes 2019-06-01 19:33:42 +02:00
Thomas Pöchtrager
4ca06cb720 Fix LTO_API_VERSION ifdefs
The documentation is wrong about these.
2019-06-01 19:33:42 +02:00
Thomas Pöchtrager
873c023069 An attempt to get TAPI platform "zippered" working
90d0bae361
2019-06-01 19:33:42 +02:00
Thomas Plöchtrager
c736cb58bd ld64: Silence i386 deprecation warning for now 2019-06-01 19:33:42 +02:00
Matthew Bauer
cf234de0a5 Run autoreconf
Command run was:

nix-shell -I nixpkgs=channel:nixos-19.03 -p autoconf automake libtool --run 'autoreconf -if'
2019-06-01 19:33:42 +02:00
Matthew Bauer
13acc08aeb Add manpages for ld64 2019-06-01 19:33:42 +02:00
Thomas Plöchtrager
5755bd8451 cctools 921 & ld64 409.12 2019-06-01 19:33:42 +02:00
Pierre Bourdon
17c2bf9247
ranlib: attempt to use utimens variants when available
When finalizing an archive, ranlib performs the following operations:
1. stat to obtain the current mtime (pre-write mtime)
2. rewrite the timestamp in the archive header
3. utime to restore the pre-write mtime

Unfortunately, utime only supports a 1s resolution. This means that on systems
with sub-second filesystem timestamps resolution (one notable example being
APFS), the following sequence of events can happen:
1. stat to obtain the current mtime (pre-write mtime) returns hh:mm:ss.123
2. rewrite the timestamp in the archive header
3. utime to restore the pre-write mtime ends up restoring hh:mm:ss.000.

This can cause ranlib to roll back the mtime of an archive in the past instead
of moving it into the future. Given that "make" heavily relies on filesystem
timestamps to determine dependencies and required rebuilds, this can lead to
many problems. This was discovered because it caused random failures when
parallel building postgresql.

To address the issue, we attempt to use utimensat if available. This is checked
via autoconf, but on macOS this is not enough: utimensat can be present at
compile time without being available at link time, and it was only added very
recently (10.13). Inspired by how CPython is handling this, we use #pragma weak
to make the runtime dependency optional.
2018-11-30 05:12:50 +01:00
Thomas Pöchtrager
07619027f8 Update autogenerated files 2018-10-24 22:04:36 +02:00
Thomas Pöchtrager
d75ed048cd Fix building otool 2018-10-24 22:04:25 +02:00
Matthew Bauer
dee6322ea0 Update autogenerated files
I used automake 1.16.1 and autoconf 2.69.
2018-10-20 18:31:53 -05:00
Matthew Bauer
6f4d579f98 Install man pages by default
Fixes #40
2018-10-20 18:30:31 -05:00
Mike Hommey
328c737100 During ThinLTO, avoid merging static data with non-static data with the same name
When doing ThinLTO, the linker updates LTO proxy atoms to point to the
right linker atoms. When there are atoms with different scope with the
same name (in the case where e.g. one translation unit has a static
instance of data and another has a global instance of data with the same
name), we may end up making all translation units using a symbol with
that name link against the one global symbol with that name.
Presumably, the same problem can happen with static/global functions
with the same name too.

When the data/code under those names happen to be identical, that's
fine, but when they're not, bad things happen.

So when dealing with LTO proxy atoms for the translation unit scope,
don't look up in the list of atoms from the linker (for global symbols).

Fixes #58
2018-08-22 16:42:39 +09:00
Mike Hommey
82381f5038 Add missing initialization for fLtoCachePath
When ThinLTO is enabled, this leads to a spurious warning to create
a directory at best, or a segfault while trying to print that
warning in the worst case.
2018-07-27 11:25:44 +09:00
sezero
08260b0151 fix typo in previous commit 2018-03-08 23:04:37 +03:00
sezero
13d098fbb0 rewrote tapi.h / libtapi support check:
it now works if the __block keyword issue is present.
2018-03-08 22:51:50 +03:00
John Regan
43062856c5 add musl-fts as dependency 2018-01-18 20:35:59 -06:00
Keno Fischer
90214560fa Port to musl libc
Mostly make sure not to use a few glibc-isms. I should note that cctools'
ar doesn't work properly when built against musl. I didn't investigate
further because dropping in llvm-ar works just fine. The error you see
with the broken ar is:

```
`x86_64-apple-darwin14-ranlib: archive member: libgcc.a(3) size too large (archive member extends past the end of the file)`
```
2017-10-26 15:25:21 -04:00
Flow86
82b4ce048d FIX: since LIB and LOCALLIB are absolute ...
... via configure, we have to remove the wrong prefix now
2017-10-01 12:19:28 +02:00
Flow86
d71e224dc2 FIX: wrong libexecdir used so as does not find its assembler
if you set a libexecdir via configure, the as tool does not find its assembler.

This is caused by a wrong search-path used. I compared it with the old odcctools which I used before, and found that the define for the directory was not used anymore
2017-10-01 12:09:45 +02:00
John Ericson
8395d4b2c3 ld: Add --dump-normalized-lib-args flag
This allows scripts to see how cctools resolves inputs. The flags are
\0-separated.

Fixes #32; See that issue for a more in-depth explanation of the
purpose of this change.
2017-09-06 17:52:37 -04:00
Thomas Pöchtrager
22ebe727a5 Add TAPIv2 support 2017-04-01 20:42:35 +02:00