GNU bug report logs - #41994
Emacs on Apple ARM devices

Previous Next

Package: emacs;

Reported by: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>

Date: Mon, 22 Jun 2020 00:03:02 UTC

Severity: normal

Tags: patch

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41994 in the body.
You can then email your comments to 41994 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Mon, 22 Jun 2020 00:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Jun 2020 00:03:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs on Apple ARM devices
Date: Mon, 22 Jun 2020 00:13:15 +0200
[Message part 1 (text/plain, inline)]
Code generation on Apple's ARM devices is mostly similar to MacOS, 
except that they expect a code signature section, which to avoid 
wasting too many bytes, are not aligned on page size as with code, 
but rather to nearest 16 bytes. In addition, the ARM compiler will 
also emit some relative pointer relocation records, which it seems 
can be safely ignored as sections aren't rearranged.

This changeset implements those changes on the Mach-O dumper so 
that Emacs can be compiled for ARM devices. With the ongoing 
convergence between the MacOS and iOS platform, and the increasing 
importance of code-signing in later MacOS versions, I think it 
could be nice to mainline these changes.

Since these sections do not occur in current MacOS builds - 
otherwise they would generate errors for being unknown - the 
changes should not impact existing places where Emacs build, and 
it would not work on iOS without to begin with.

Hat tip to Aaron Griffith for sharing his knowledge.


-- 
Sincerely,

Roland Kaufmann






[0001-Let-us-know-unknown-number-being-complained-about.patch (text/x-patch, attachment)]
[0002-Make-function-generally-available-for-sections.patch (text/x-patch, attachment)]
[0003-Allow-padding-of-sections-to-other-than-page-size.patch (text/x-patch, attachment)]
[0004-Output-code-signature-sections-align-on-16-bytes.patch (text/x-patch, attachment)]
[0005-Make-relocation-of-relative-pointers-a-no-op.patch (text/x-patch, attachment)]
[0006-Allow-build-configuration-on-Apple-ARM-devices.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 00:51:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Fri, 14 Aug 2020 09:18:01 GMT) Full text and rfc822 format available.

Message #10 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>
Cc: 41994 <at> debbugs.gnu.org
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Fri, 14 Aug 2020 02:17:18 -0700
Roland Kaufmann <rlndkfmn+emacs <at> gmail.com> writes:

> Code generation on Apple's ARM devices is mostly similar to MacOS, except that
> they expect a code signature section, which to avoid wasting too many bytes, are
> not aligned on page size as with code, but rather to nearest 16 bytes. In
> addition, the ARM compiler will also emit some relative pointer relocation
> records, which it seems can be safely ignored as sections aren't rearranged.
>
> This changeset implements those changes on the Mach-O dumper so that Emacs can
> be compiled for ARM devices. With the ongoing convergence between the MacOS and
> iOS platform, and the increasing importance of code-signing in later MacOS
> versions, I think it could be nice to mainline these changes.
>
> Since these sections do not occur in current MacOS builds - otherwise they would
> generate errors for being unknown - the changes should not impact existing
> places where Emacs build, and it would not work on iOS without to begin with.
>
> Hat tip to Aaron Griffith for sharing his knowledge.

This series of patches was submitted 8 weeks ago, but never got a reply
at the time.

Could someone with more knowledge about this please help review it?

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Fri, 14 Aug 2020 14:16:02 GMT) Full text and rfc822 format available.

Message #13 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>, 41994 <at> debbugs.gnu.org
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Fri, 14 Aug 2020 16:15:40 +0200
>>>>> On Fri, 14 Aug 2020 02:17:18 -0700, Stefan Kangas <stefan <at> marxist.se> said:

    Stefan> Roland Kaufmann <rlndkfmn+emacs <at> gmail.com> writes:
    >> Code generation on Apple's ARM devices is mostly similar to MacOS, except that
    >> they expect a code signature section, which to avoid wasting too many bytes, are
    >> not aligned on page size as with code, but rather to nearest 16 bytes. In
    >> addition, the ARM compiler will also emit some relative pointer relocation
    >> records, which it seems can be safely ignored as sections aren't rearranged.
    >> 
    >> This changeset implements those changes on the Mach-O dumper so that Emacs can
    >> be compiled for ARM devices. With the ongoing convergence between the MacOS and
    >> iOS platform, and the increasing importance of code-signing in later MacOS
    >> versions, I think it could be nice to mainline these changes.
    >> 
    >> Since these sections do not occur in current MacOS builds - otherwise they would
    >> generate errors for being unknown - the changes should not impact existing
    >> places where Emacs build, and it would not work on iOS without to begin with.
    >> 
    >> Hat tip to Aaron Griffith for sharing his knowledge.

    Stefan> This series of patches was submitted 8 weeks ago, but never got a reply
    Stefan> at the time.

    Stefan> Could someone with more knowledge about this please help review it?

Are these patches even still needed now that emacs-27 has a portable
dumper?

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Fri, 14 Aug 2020 20:12:02 GMT) Full text and rfc822 format available.

Message #16 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>, 41994 <at> debbugs.gnu.org,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Fri, 14 Aug 2020 22:11:46 +0200 (CEST)
On Fri, Aug 14, 2020 at 04:15:40PM +0200, Robert Pluim wrote:
> >>>>> On Fri, 14 Aug 2020 02:17:18 -0700, Stefan Kangas <stefan <at> marxist.se> said:
> 
>     Stefan> Roland Kaufmann <rlndkfmn+emacs <at> gmail.com> writes:
>     >> Code generation on Apple's ARM devices is mostly similar to MacOS, except that
>     >> they expect a code signature section, which to avoid wasting too many bytes, are
>     >> not aligned on page size as with code, but rather to nearest 16 bytes. In
>     >> addition, the ARM compiler will also emit some relative pointer relocation
>     >> records, which it seems can be safely ignored as sections aren't rearranged.
>     >> 
>     >> This changeset implements those changes on the Mach-O dumper so that Emacs can
>     >> be compiled for ARM devices. With the ongoing convergence between the MacOS and
>     >> iOS platform, and the increasing importance of code-signing in later MacOS
>     >> versions, I think it could be nice to mainline these changes.
>     >> 
>     >> Since these sections do not occur in current MacOS builds - otherwise they would
>     >> generate errors for being unknown - the changes should not impact existing
>     >> places where Emacs build, and it would not work on iOS without to begin with.
>     >> 
>     >> Hat tip to Aaron Griffith for sharing his knowledge.
> 
>     Stefan> This series of patches was submitted 8 weeks ago, but never got a reply
>     Stefan> at the time.
> 
>     Stefan> Could someone with more knowledge about this please help review it?
> 
> Are these patches even still needed now that emacs-27 has a portable
> dumper?

That's what I was wondering (although to be honest I never even
noticed there were patches attached).

I suspect the patch to configure.ac might be needed even for the
pdumpder?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Fri, 14 Aug 2020 22:11:01 GMT) Full text and rfc822 format available.

Message #19 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>
To: 41994 <at> debbugs.gnu.org
Cc: Alan Third <alan <at> idiocy.org>, Stefan Kangas <stefan <at> marxist.se>,
 Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Sat, 15 Aug 2020 00:10:22 +0200
RK> Code generation on Apple's ARM devices ... expect a code
RK> signature section ... This changeset implements those changes
RK> on the Mach-O dumper

RP> Are these ... still needed now that emacs-27 has a portable
RP> dumper?

This may be a case of incredible bad timing, as I haven't kept up 
on the development of the pdumper. Doing some light reading up on 
it now, it seems to me that it does the loading from a custom file 
format instead of writing a native executable.

Evidently, this renders any improvements on the unexec code moot, 
although it's still in the tree, I guess for platforms where the 
pdumper is not yet fully tested, so I understand the reluctance to 
spend any more scarce time on it.

AT> I suspect the patch to configure.ac might be needed even for 
AT> the pdumpder?

Yes, although one could discuss if the concept of ported/unported 
status still applies in the same way once there is the pdumper.


-- 
Yours sincerely,

Roland Kaufmann




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Fri, 14 Aug 2020 23:05:02 GMT) Full text and rfc822 format available.

Message #22 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>
Cc: 41994 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>,
 Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Sat, 15 Aug 2020 01:04:27 +0200 (CEST)
On Sat, Aug 15, 2020 at 12:10:22AM +0200, Roland Kaufmann wrote:
> RK> Code generation on Apple's ARM devices ... expect a code
> RK> signature section ... This changeset implements those changes
> RK> on the Mach-O dumper
> 
> RP> Are these ... still needed now that emacs-27 has a portable
> RP> dumper?
> 
> This may be a case of incredible bad timing, as I haven't kept up on the
> development of the pdumper. Doing some light reading up on it now, it seems
> to me that it does the loading from a custom file format instead of writing
> a native executable.
> 
> Evidently, this renders any improvements on the unexec code moot, although
> it's still in the tree, I guess for platforms where the pdumper is not yet
> fully tested, so I understand the reluctance to spend any more scarce time
> on it.

Yes, unfortunately I think it's unlikely anyone will be wanting to run
unexec on macOS from now on.

It may be worth seeing if the gccemacs (native elisp compilation)
project will need something like this. I don't know enough about
either these requirements or gccemacs to say.

> AT> I suspect the patch to configure.ac might be needed even for
> AT> the pdumpder?
> 
> Yes, although one could discuss if the concept of ported/unported status
> still applies in the same way once there is the pdumper.

Well, I may as well commit it. Have you contributed to Emacs before
and if so have you signed the copyright paperwork? This is small
enough that it should be exempt, but I'd rather get the notation
correct. :)
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Sat, 15 Aug 2020 07:39:01 GMT) Full text and rfc822 format available.

Message #25 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>
To: 41994 <at> debbugs.gnu.org
Cc: Alan Third <alan <at> idiocy.org>, Stefan Kangas <stefan <at> marxist.se>,
 Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Sat, 15 Aug 2020 09:38:36 +0200
AT> It may be worth seeing if the gccemacs (native elisp
AT> compilation) project will need something like this.

It would be nice if they could serve as some "notes of things to 
consider"; I guess it depends on whether gccemacs ever spill a 
Mach-O executable or if all compilation happens in memory.

AT> Well, I may as well commit it. Have you contributed to Emacs 
AT> before and if so have you signed the copyright paperwork?

No, but please send me the forms (or links) and I'll be glad to 
fill them, in that case.

-- 
Yours sincerely,

Roland Kaufmann




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41994; Package emacs. (Sat, 15 Aug 2020 11:46:02 GMT) Full text and rfc822 format available.

Message #28 received at 41994 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>
Cc: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>, 41994 <at> debbugs.gnu.org,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Sat, 15 Aug 2020 13:45:18 +0200
>>>>> On Fri, 14 Aug 2020 22:11:46 +0200 (CEST), Alan Third <alan <at> idiocy.org> said:
    Alan> That's what I was wondering (although to be honest I never even
    Alan> noticed there were patches attached).

    Alan> I suspect the patch to configure.ac might be needed even for the
    Alan> pdumpder?

Yes, I think so. If someone sends me an arm-based mac Iʼm willing to
test that hypothesis :-)

Seriously, itʼs a one-liner. I think we can commit it as obvious.

Robert




Reply sent to Alan Third <alan <at> idiocy.org>:
You have taken responsibility. (Sat, 15 Aug 2020 16:18:02 GMT) Full text and rfc822 format available.

Notification sent to Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>:
bug acknowledged by developer. (Sat, 15 Aug 2020 16:18:02 GMT) Full text and rfc822 format available.

Message #33 received at 41994-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Roland Kaufmann <rlndkfmn+emacs <at> gmail.com>, 41994-done <at> debbugs.gnu.org,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#41994: Emacs on Apple ARM devices
Date: Sat, 15 Aug 2020 18:17:08 +0200 (CEST)
On Sat, Aug 15, 2020 at 01:45:18PM +0200, Robert Pluim wrote:
> >>>>> On Fri, 14 Aug 2020 22:11:46 +0200 (CEST), Alan Third <alan <at> idiocy.org> said:
>     Alan> That's what I was wondering (although to be honest I never even
>     Alan> noticed there were patches attached).
> 
>     Alan> I suspect the patch to configure.ac might be needed even for the
>     Alan> pdumpder?
> 
> Yes, I think so. If someone sends me an arm-based mac Iʼm willing to
> test that hypothesis :-)
> 
> Seriously, itʼs a one-liner. I think we can commit it as obvious.

I've pushed it with the copyright exempt tag.

4cba236749aafade7bd88cf2a10be48f44983faa

I don't think there's any point keeping this bug report open, so I'll
close it now.

Thanks.
-- 
Alan Third




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Sep 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.