public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Building GNU Arm Embedded Toolchain for macOS/arm64
@ 2021-11-02 13:09 Romain Goyet
  2021-11-02 15:34 ` Iain Sandoe
  2021-11-03 16:08 ` Andrea Corallo
  0 siblings, 2 replies; 5+ messages in thread
From: Romain Goyet @ 2021-11-02 13:09 UTC (permalink / raw)
  To: gcc-patches

Hello,

Arm distribute pre-built versions of GCC that targets bare-metal Cortex-M
devices at
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm

They offer a source release as well as pre-built binaries for Linux, macOS
and Windows.

The macOS version is only built for the x86_64 architecture, even though
more and more macOS devices run on aarch64.

I have written a few small patches to get this toolchain to build and run
on macOS/arm64. Should I submit them somewhere?

Thanks!

 - Romain

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

* Re: Building GNU Arm Embedded Toolchain for macOS/arm64
  2021-11-02 13:09 Building GNU Arm Embedded Toolchain for macOS/arm64 Romain Goyet
@ 2021-11-02 15:34 ` Iain Sandoe
  2021-11-02 20:12   ` Romain Goyet
  2021-11-03 16:08 ` Andrea Corallo
  1 sibling, 1 reply; 5+ messages in thread
From: Iain Sandoe @ 2021-11-02 15:34 UTC (permalink / raw)
  To: Romain Goyet; +Cc: gcc-patches

Hi Romain

> On 2 Nov 2021, at 13:09, Romain Goyet via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> Arm distribute pre-built versions of GCC that targets bare-metal Cortex-M
> devices at
> https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm

> I have written a few small patches to get this toolchain to build and run
> on macOS/arm64. Should I submit them somewhere?

The work to implement Arm64 on macOS is on-going (prototype is here:
https://github.com/iains/gcc-darwin-arm64)

The patches for host-side support are mostly ready (probably your patches will be
quite similar to those on the prototype, but if there’s something extra we’ve missed so far
please feel free to post them to this list - please cc me).

I am hoping to get the host-side stuff into master first (and reasonably soon).

thanks
Iain

main host-side support:

https://github.com/iains/gcc-darwin-arm64/commit/af097efc24a72c005756b05f65f0f450e41340ed
+ next four patches (deals with the fact that Arm64-darwin cannot use PCH).

driver:
https://github.com/iains/gcc-darwin-arm64/commit/5757cced1e1c8d4f0ec5458b9af7154d694e400b

ada host-side tools.
https://github.com/iains/gcc-darwin-arm64/commit/c16becf974da73646eb7b5e356323ffa4a585b21


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

* Re: Building GNU Arm Embedded Toolchain for macOS/arm64
  2021-11-02 15:34 ` Iain Sandoe
@ 2021-11-02 20:12   ` Romain Goyet
  2021-11-02 20:22     ` Iain Sandoe
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Goyet @ 2021-11-02 20:12 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: gcc-patches

Hi Iain,

Thanks for your reply! However, what I'm referring to is a lot more simple
than that: I just want to build bare-metal binaries for Cortex-M devices
from a Darwin/arm64 host. Not to produce Mach-O binaries that can run on
Darwin/arm64.

Essentially, I just made the toolchain at
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
run on macOS/arm64. It still only produces Cortex-M ELF binaries.

I'm looking for the right person at Arm to help them ship a pre-built arm64
image on the page above. I'm really trying to solve a very practical
problem. My patches are super simple:
- Fix their build-prerequisite.sh and build-toolchain.sh scripts
- Fix GMP so it uses the proper macOS syntax on Arm
- Fix libelf so it picks up stdlib.h
- Fix a gcc-hook

Thanks!

 - Romain


On Tue, Nov 2, 2021 at 11:35 AM Iain Sandoe <iain@sandoe.co.uk> wrote:

> Hi Romain
>
> > On 2 Nov 2021, at 13:09, Romain Goyet via Gcc-patches <
> gcc-patches@gcc.gnu.org> wrote:
>
> > Arm distribute pre-built versions of GCC that targets bare-metal Cortex-M
> > devices at
> >
> https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
>
> > I have written a few small patches to get this toolchain to build and run
> > on macOS/arm64. Should I submit them somewhere?
>
> The work to implement Arm64 on macOS is on-going (prototype is here:
> https://github.com/iains/gcc-darwin-arm64)
>
> The patches for host-side support are mostly ready (probably your patches
> will be
> quite similar to those on the prototype, but if there’s something extra
> we’ve missed so far
> please feel free to post them to this list - please cc me).
>
> I am hoping to get the host-side stuff into master first (and reasonably
> soon).
>
> thanks
> Iain
>
> main host-side support:
>
>
> https://github.com/iains/gcc-darwin-arm64/commit/af097efc24a72c005756b05f65f0f450e41340ed
> + next four patches (deals with the fact that Arm64-darwin cannot use PCH).
>
> driver:
>
> https://github.com/iains/gcc-darwin-arm64/commit/5757cced1e1c8d4f0ec5458b9af7154d694e400b
>
> ada host-side tools.
>
> https://github.com/iains/gcc-darwin-arm64/commit/c16becf974da73646eb7b5e356323ffa4a585b21
>
>

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

* Re: Building GNU Arm Embedded Toolchain for macOS/arm64
  2021-11-02 20:12   ` Romain Goyet
@ 2021-11-02 20:22     ` Iain Sandoe
  0 siblings, 0 replies; 5+ messages in thread
From: Iain Sandoe @ 2021-11-02 20:22 UTC (permalink / raw)
  To: Romain Goyet; +Cc: gcc-patches

Hi Romain,

> On 2 Nov 2021, at 20:12, Romain Goyet <romain.goyet@numworks.com> wrote:
> 

> Thanks for your reply! However, what I'm referring to is a lot more simple than that: I just want to build bare-metal binaries for Cortex-M devices from a Darwin/arm64 host. Not to produce Mach-O binaries that can run on Darwin/arm64.

> Essentially, I just made the toolchain at https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm run on macOS/arm64. It still only produces Cortex-M ELF binaries.

Right, the host-side support is a small set of patches from the larger project to make ‘native' aarch64 support.

by host-side I just mean enough to be able to build a cross-compiler (e.g. using clang) that runs on aarch64-darwin and produces output for some other target - I believe that is your intent as you describe here.

> I'm looking for the right person at Arm to help them ship a pre-built arm64 image on the page above. I'm really trying to solve a very practical problem. My patches are super simple:
> - Fix their build-prerequisite.sh and build-toolchain.sh scripts
> - Fix GMP so it uses the proper macOS syntax on Arm
> - Fix libelf so it picks up stdlib.h

^^^ these are patches that would need to be sent to the appropriate “upstream” for the project in question - we don’t keep local patches to GMP or libelf in the GCC tree.

> - Fix a gcc-hook

OK, then please post that patch here, and we’ll take a look.

FWIW, I would expect for a general solution you’d need to deal (somehow) with the PCH issue ( I guess for embedded you might not care about Ada ;) )

Iain


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

* Re: Building GNU Arm Embedded Toolchain for macOS/arm64
  2021-11-02 13:09 Building GNU Arm Embedded Toolchain for macOS/arm64 Romain Goyet
  2021-11-02 15:34 ` Iain Sandoe
@ 2021-11-03 16:08 ` Andrea Corallo
  1 sibling, 0 replies; 5+ messages in thread
From: Andrea Corallo @ 2021-11-03 16:08 UTC (permalink / raw)
  To: Romain Goyet via Gcc-patches; +Cc: Romain Goyet

Romain Goyet via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

> Hello,
>
> Arm distribute pre-built versions of GCC that targets bare-metal Cortex-M
> devices at
> https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
>
> They offer a source release as well as pre-built binaries for Linux, macOS
> and Windows.
>
> The macOS version is only built for the x86_64 architecture, even though
> more and more macOS devices run on aarch64.
>
> I have written a few small patches to get this toolchain to build and run
> on macOS/arm64. Should I submit them somewhere?
>
> Thanks!
>
>  - Romain

Hi Romain,

thank you for work.

- Arm is working on an GNU RM toolchain for macos-Arm64, and is
  tentatively aiming for a release early next year

- You are welcome to share/contribute scripts to the repos of your
  choice for community.  Arm doesn't have any forum (as of now) where
  can review changes related to build scripts.  If these are GCC patches
  gcc-patches is probably the right place to propose and discuss them.

Best Regards

  Andrea

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

end of thread, other threads:[~2021-11-03 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 13:09 Building GNU Arm Embedded Toolchain for macOS/arm64 Romain Goyet
2021-11-02 15:34 ` Iain Sandoe
2021-11-02 20:12   ` Romain Goyet
2021-11-02 20:22     ` Iain Sandoe
2021-11-03 16:08 ` Andrea Corallo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).