Skip to content

AsMain/main.s: align to 4 byte boundary #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2020
Merged

Conversation

zhuowei
Copy link
Contributor

@zhuowei zhuowei commented Jul 4, 2020

ARM instructions must be aligned to 4 bytes.
Without this directive, ld complains:

ld: warning: arm64 function not 4-byte aligned: _main from HelloWorld.o
ld: warning: arm64 function not 4-byte aligned: helloworld from HelloWorld.o

Clang uses the .p2align directive to ensure this; you can see it if you run:

clang -S -Os -c -target arm64-apple-macos test.c

zhuowei and others added 2 commits July 4, 2020 13:53
ARM instructions must be aligned to 4 bytes.
Without this directive, ld complains:

```
ld: warning: arm64 function not 4-byte aligned: _main from HelloWorld.o
ld: warning: arm64 function not 4-byte aligned: helloworld from HelloWorld.o
```

Clang uses the .p2align directive to ensure this; you can see it if you run:

```
clang -S -Os -c -target arm64-apple-macos test.c
```
@below below merged commit 89a7daf into below:main Jul 5, 2020
neldredge added a commit to neldredge/HelloSilicon that referenced this pull request Mar 25, 2025
Remove incorrect comment about `LSL X1, X2, below#1` being an alias for `ORR X1, XZR, X2, LSL below#1`.  Per the Architecture Reference Manual, it is instead an alias for `UBFM X1, X2, below#63, below#62`.  (Of course they have the same effect.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants