Bug 217753 - lld [llvm 4.0.0] Linker won't link on aarch64 (Error: Failed to open a.out)
Summary: lld [llvm 4.0.0] Linker won't link on aarch64 (Error: Failed to open a.out)
Status: Closed DUPLICATE of bug 217189
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-13 13:17 UTC by Wolfgang Meyer
Modified: 2017-03-15 15:30 UTC (History)
1 user (show)

See Also:


Attachments
Output for verbose compilation/linking (cc -v -Wl,--verbose conftest.c) (1.68 KB, text/plain)
2017-03-13 13:17 UTC, Wolfgang Meyer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Meyer 2017-03-13 13:17:26 UTC
Created attachment 180774 [details]
Output for verbose compilation/linking (cc -v -Wl,--verbose conftest.c)

When trying to compile C sources on 12-CURRENT (aarch64) with the newly integrated LLVM 4.0 toolchain the compilation fails with ld giving an error on failing to open the executable file to be produced by the compilation. An empty file with the executable name and a .tmpXXXXXXX suffix is produced by the linking process.

This has been observed using poudriere jails with a FreeBSD 12-CURRENT for aarch64 after integration of the llvm 4.0 toolchain (tested with base r314564 and base r315016) running on an amd64 host using qemu-user-static for arm64 execution.

How to reproduce:
Build poudriere jail for HEAD and aarch64 architecture.
Enter jail and try to compile typical configure test source (referred to as conftest.c):

  int main()
  {
    ;
    return 0;
  }

Compilation:
>cc conftest.c
Output:
/usr/bin/ld: error: failed to open a.out: Unknown error -1
cc: error: linker command failed with exit code 1 (use -v to see invocation)

An empty a.out.tmpXXXXXXX is produced.

This happens with qemu-aarch64-static 2.6.90.g20160728_1 ( ports r424575 ).
With qemu-aarch64-static 2.8.50.g20170307 ( ports r435636 ) I get a qemu error:
/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-c0989c8/tcg/tcg.c:2017: tcg fatal error
cc: error: unable to execute command: Abort trap (core dumped)
cc: error: linker command failed due to signal (use -v to see invocation)

Using lld 3.9.0 on aarch64 poudriere jails works fine with either qemu-emulated execution.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-03-15 15:30:10 UTC
Marking dup unless you can reproduce without qemu-user-static. lld works fine on aarch64 reference machines[1].

[1] https://www.freebsd.org/internal/machines.html

*** This bug has been marked as a duplicate of bug 217189 ***