View Issue Details

IDProjectCategoryView StatusLast Update
0038225FPCCompilerpublic2021-05-09 15:44
ReporterIgor Kokarev Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformApple DTKOSmacOS 
Fixed in Version3.3.1 
Summary0038225: Assembler errors when compiling Lazarus Trunk for macOS/AArch64
DescriptionCan't compule new Lazarus trunk for aarch64 target on Apple DTK
FPC where compiled correctly. A month ago I compiled old trunk version without a problem.

FPC 3.3.1 trunk and Lazarus trunk were downloaded today.
macOS Big Sur 11.1 Xcode 12.3
Steps To Reproducegit clone https://github.com/graemeg/lazarus
make bigide

Additional Informationlib/aarch64-darwin/cocoa/tatextelements.s:543:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:544:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:546:9: error: invalid operand for instruction
        add x1,w1,w1,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:547:9: error: invalid operand for instruction
        asr w1,x1,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3829:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3830:9: error: invalid operand for instruction
        asr w1,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3832:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3833:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3931:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3932:9: error: invalid operand for instruction
        asr w1,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3934:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3935:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
tatextelements.pas(944) Error: (9007) Error while assembling exitcode 1
tatextelements.pas(944) Fatal: (10026) There were 2 errors compiling module, stopping
Fatal: (1018) Compilation aborted
make[2]: *** [tachartlazaruspkg.ppu] Error 1
make[1]: *** [bigide] Error 2
make: *** [bigidecomponents] Error 2
TagsNo tags attached.
Fixed in Revision47812
FPCOldBugId
FPCTarget-
Attached Files

Activities

Chris Rorden

2020-12-17 14:28

reporter   ~0127650

With my M1 Mac:

1. I can replicate this bug using aarch64 FPC 3.3.1 [2020/12/01] with Lazarus Trunk.
2. I can resolve this problem using aarch64 FPC 3.3.1 [2020/12/01] with Lazarus Trunk if I remove the tachartlazaruspkg package. With this change, lazarus compiles fine.

With my Intel Mac:
1. Compiles fine using FPC 3.2.0 [2020/05/31] with Lazarus Trunk.
2. Compiles fine using FPC 3.3.1 [2020/12/16] with Lazarus Trunk.

Igor Kokarev

2020-12-17 20:33

reporter   ~0127655

How I can get old trunk version to compile for aarch64?

Trevor Roydhouse

2020-12-17 21:50

reporter   ~0127658

I raised it earlier with wp on the forums: https://forum.lazarus.freepascal.org/index.php/topic,52325.0.html but there was little interest in resolving it.

My workaround is to build Lazarus without "bigide" and then add the other packages I use (I don't use tachart).

Florian

2020-12-17 22:53

administrator   ~0127659

Could somebody please compile with -al and post the relevant assembler lines?

Igor Kokarev

2020-12-18 10:08

reporter   ~0127664

Trevor, thanks! I compiled the new Lazarus trunk with "make" without "bigide".

Regrettably my knowledge is limited for correct debugging of this problem.

Chris Rorden

2020-12-18 13:51

reporter   ~0127666

Output for
tachart > /usr/local/bin/ppca64 -MObjFPC -Scghi -OoNOPEEPHOLE -al -g -gl -Xg -l -vewnhibq -dLCL -dLCLcocoa -dCHECK_VALID_SCALING -gw -Funumlib_fix -Fueditors -Fu../../packager/units/aarch64-darwin -Fu../lazutils/lib/aarch64-darwin -Fu../buildintf/units/aarch64-darwin -Fu../freetype/lib/aarch64-darwin -Fu../../lcl/units/aarch64-darwin -Fu../../lcl/units/aarch64-darwin/cocoa -Fu../lazcontrols/lib/aarch64-darwin/cocoa -Fu../ideintf/units/aarch64-darwin/cocoa -Fu. -Fu/usr/local/lib/fpc/3.3.1/units/aarch64-darwin/rtl -FE. -FUlib/aarch64-darwin/cocoa -daarch64 tachartlazaruspkg.pas


lib/aarch64-darwin/cocoa/tatextelements.s:700:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:701:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:703:9: error: invalid operand for instruction
        add x1,w1,w1,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:704:9: error: invalid operand for instruction
        asr w1,x1,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4840:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4841:9: error: invalid operand for instruction
        asr w1,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4843:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4844:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4963:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4964:9: error: invalid operand for instruction
        asr w1,x0,0000001
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4966:9: error: invalid operand for instruction
        add x0,w0,w0,lsr 0000063
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:4967:9: error: invalid operand for instruction
        asr w0,x0,0000001
                   ^
tatextelements.s.zip (229,073 bytes)

Chris Rorden

2020-12-18 13:53

reporter   ~0127667

p.s. The default compilation uses -O1, for the uploaded data I ran without this optimization to see if it would resolve this error (which it did not).

Chris Rorden

2020-12-18 14:17

reporter   ~0127668

Looks like all the errors regard "div 2" - sometimes applied to more than one dimension ("Result += MeasureLabel(ADrawer, AText) div 2;" where the result is a TSize with x and y components). Maybe related to other div issues (https://bugs.freepascal.org/view.php?id=38180).

Igor Kokarev

2020-12-21 11:25

reporter   ~0127742

Last edited: 2020-12-21 11:25

View 2 revisions

Thank you! Now Lazarus trunk compiles fine (make bigide) on Apple M1 aarch64/darwin.

Trevor Roydhouse

2021-01-24 21:53

reporter   ~0128576

Igor, now this is fixed, please close the issue.

Igor Kokarev

2021-05-09 15:44

reporter   ~0130806

The problem is fully solved now.

Issue History

Date Modified Username Field Change
2020-12-16 17:25 Igor Kokarev New Issue
2020-12-16 18:02 Jonas Maebe Project Lazarus => FPC
2020-12-16 18:03 Jonas Maebe Product Version 2.1 (SVN) =>
2020-12-16 18:03 Jonas Maebe Summary Can't compile new Lazarus Trunk on Apple DTK => Assembler errors when compiling Lazarus Trunk for macOS/AArch64
2020-12-16 18:03 Jonas Maebe FPCTarget => -
2020-12-17 14:28 Chris Rorden Note Added: 0127650
2020-12-17 20:33 Igor Kokarev Note Added: 0127655
2020-12-17 21:50 Trevor Roydhouse Note Added: 0127658
2020-12-17 22:53 Florian Note Added: 0127659
2020-12-18 10:08 Igor Kokarev Note Added: 0127664
2020-12-18 13:51 Chris Rorden Note Added: 0127666
2020-12-18 13:51 Chris Rorden File Added: tatextelements.s.zip
2020-12-18 13:53 Chris Rorden Note Added: 0127667
2020-12-18 14:17 Chris Rorden Note Added: 0127668
2020-12-18 22:40 Florian Assigned To => Florian
2020-12-18 22:40 Florian Status new => resolved
2020-12-18 22:40 Florian Resolution open => fixed
2020-12-18 22:40 Florian Fixed in Version => 3.3.1
2020-12-18 22:40 Florian Fixed in Revision => 47812
2020-12-21 11:25 Igor Kokarev Note Added: 0127742
2020-12-21 11:25 Igor Kokarev Note Edited: 0127742 View Revisions
2021-01-24 21:53 Trevor Roydhouse Note Added: 0128576
2021-05-09 15:44 Igor Kokarev Status resolved => closed
2021-05-09 15:44 Igor Kokarev Note Added: 0130806