public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* CLANG cross-compilation issue
@ 2016-09-07 15:27 Leif Lindholm
  2016-09-07 15:34 ` Andrew Fish
  0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2016-09-07 15:27 UTC (permalink / raw)
  To: edk2-devel

Hi all,

This is a report for the archive, rather than anything easily fixable.
While testing one of Ard's sets against CLANG, I tripped over a
behaviour exposed by commit a1b8baccc30b
(BaseTools GCC: use 'gcc' as the linker command for GCC44 and later).

This commit changes the CLANG profiles to invoke the linker via the
'clang' command, rather than as previously directly calling ld (with
appropriate cross toolchain prefix where needed).

Turns out clang, at least the one packaged in Debian 'Jessie', does
not scan the PATH when looking for cross-variants of GNU ld, but
rather goes and looks for it in some commonly used locations. Failing
to find any, it then falls back to the system-provided ld.

The symptom is a failed link step with the message:
/usr/bin/ld: unrecognised emulation mode: aarch64linux

As a workaround, I was able to get my build functional again by
creating a symbolic link /usr/bin/aarch64-linux-gnueabi-ld pointing at
the actual location of my cross-ld.

/
    Leif


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CLANG cross-compilation issue
  2016-09-07 15:27 CLANG cross-compilation issue Leif Lindholm
@ 2016-09-07 15:34 ` Andrew Fish
  2016-09-15  9:49   ` Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Fish @ 2016-09-07 15:34 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel


> On Sep 7, 2016, at 8:27 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> 
> Hi all,
> 
> This is a report for the archive, rather than anything easily fixable.
> While testing one of Ard's sets against CLANG, I tripped over a
> behaviour exposed by commit a1b8baccc30b
> (BaseTools GCC: use 'gcc' as the linker command for GCC44 and later).
> 
> This commit changes the CLANG profiles to invoke the linker via the
> 'clang' command, rather than as previously directly calling ld (with
> appropriate cross toolchain prefix where needed).
> 
> Turns out clang, at least the one packaged in Debian 'Jessie', does
> not scan the PATH when looking for cross-variants of GNU ld, but
> rather goes and looks for it in some commonly used locations. Failing
> to find any, it then falls back to the system-provided ld.
> 
> The symptom is a failed link step with the message:
> /usr/bin/ld: unrecognised emulation mode: aarch64linux
> 
> As a workaround, I was able to get my build functional again by
> creating a symbolic link /usr/bin/aarch64-linux-gnueabi-ld pointing at
> the actual location of my cross-ld.
> 

Leif,

I'm not sure it works the same as Xcode, but one of the search paths is often relative to the current location of the tools. This could be macOS specific as the tools don't install in /usr/bin anymore, and those locations just contain a reflector to the active toolchain. 

Thanks,

Andrew Fish

> /
>    Leif
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CLANG cross-compilation issue
  2016-09-07 15:34 ` Andrew Fish
@ 2016-09-15  9:49   ` Leif Lindholm
  0 siblings, 0 replies; 3+ messages in thread
From: Leif Lindholm @ 2016-09-15  9:49 UTC (permalink / raw)
  To: Andrew Fish; +Cc: edk2-devel

Hi Andrew, list,

Just a follow-up.

On Wed, Sep 07, 2016 at 08:34:47AM -0700, Andrew Fish wrote:
> > The symptom is a failed link step with the message:
> > /usr/bin/ld: unrecognised emulation mode: aarch64linux
> > 
> > As a workaround, I was able to get my build functional again by
> > creating a symbolic link /usr/bin/aarch64-linux-gnueabi-ld pointing at
> > the actual location of my cross-ld.
> 
> I'm not sure it works the same as Xcode, but one of the search paths
> is often relative to the current location of the tools. This could
> be macOS specific as the tools don't install in /usr/bin anymore,
> and those locations just contain a reflector to the active
> toolchain.

I had a chat with our toolchain guys, and apparently this bug was
fixed over 5 years ago for the BSD platforms (including OS X), but for
some reason didn't get carried across to GNU:
https://llvm.org/bugs/show_bug.cgi?id=9777

They've now put on their schedule to fix this behaviour for GNU also.

Regards,

Leif


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-15  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-07 15:27 CLANG cross-compilation issue Leif Lindholm
2016-09-07 15:34 ` Andrew Fish
2016-09-15  9:49   ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox