Alignment greater than 16 - how to set without warnings?

Problems which concern EuroAssembler
AndreyDmitriev
Posts: 9
Joined: 01 Jun 2023 09:11

Alignment greater than 16 - how to set without warnings?

Unread postby AndreyDmitriev » 24 Sep 2025 19:12

If I try to set an alignment greater than 16 for some reason, the following warnings are issued:

W3410 Requested alignment 4096 is greater then alignment 16 of section [.bss]. "addresses.asm"{10}
W3410 Requested alignment 64 is greater then alignment 16 of section [.text]. "addresses.asm"{18}

These seem to be warnings only, and the alignment appears to work. But how can I properly override this "default" alignment of 16 and avoid these warning (other than disable W3410 by options)?


| |EUROASM AutoSegment=Yes, CPU=X64, SIMD=AVX2
| |addresses PROGRAM Format=PE, Width=64, Model=Flat, IconFile=, Entry=Start:
|[.text] ::::Section changed.
|00000000: |
|00000000: |INCLUDE winscon.htm, winabi.htm, cpuext64.htm
|00000000: * INCLUDE "./maclib/winscon.htm"
|[.text] ::::Section changed.
|00000000: * INCLUDE "./maclib/winabi.htm"
|00000000: * INCLUDE "./maclib/cpuext64.htm"
|00000000: |
|[.data] ::::Section changed.
|00000000:4461746120416464~|Msg1 D "Data Address is ",0
|[.bss] ::::Section changed.
|00000000:................~|Buf1 DB 32 * B
|[.data] ::::Section changed.
|00000011:436F646520524950~|Msg2 D "Code RIP Address is ",0
|[.bss] ::::Section changed.
|00000020:................~|Buf2 DB 32 * B
|00000040:................~|align 4096
|## W3410 Requested alignment 4096 is greater then alignment 16 of section [.bss].
|00001000:................~|Array DB 65536 * Q ; Some Data aligned to page boundary
|00081000: |
|[.text] ::::Section changed.
|00000000:90 |Start: nop
|00000001:48B8[0010000000~~| MOV RAX, Array
|0000000B: | StoH Buf1
|00000019: | StdOutput Msg1, Buf1, Eol=Yes, Console=Yes
|00000054: |
|00000054:660F1F8420000000~|align 64
|## W3410 Requested alignment 64 is greater then alignment 16 of section [.text].
|00000080:E800000000 | CALL get_rip
|00000085: |get_rip:
|00000085:58 | POP RAX
|00000086:4883E805 | SUB RAX, 5 ; E800000000 | CALL get_rip
|0000008A: | StoH Buf2
|00000098: | StdOutput Msg2, Buf2, Eol=Yes, Console=Yes
|000000D3: |
|000000D3: | TerminateProgram
| |ENDPROGRAM

User avatar
vitsoft
Site Admin
Posts: 54
Joined: 04 Nov 2017 20:08
Location: Vítkov, The Czech Republic
Contact:

Re: Alignment greater than 16 - how to set without warnings?

Unread postby vitsoft » 25 Sep 2025 18:46

Disable warning W3410 is not a good idea, it might disalign your variables when they are mixed with shorter variables or when your program is one of modules which will be linked to PE.

Default alignment of segments built in €ASM ([.text], [.rodata], [.data], .bss]) is indeed 16 bytes only, but it may be easily overriden if you declare these segments explicitly.
Just add below the PROGRAM statement a new explicit declaration:

[.bss] SEGMENT ALIGN=4096
[.text] SEGMENT ALIGN=64
EUROASM AutoSegment=yes  ; You need to repeat this option if you want to keep using autosegmentation (explicit declaration turns it off).

Or you could also use

EUROASM PUSH                    ; Save all €ASM options.
[.bss] SEGMENT ALIGN=4096
[.text] SEGMENT ALIGN=64
EUROASM POP                      ; Restore saved option, including %^AutoSegment
AndreyDmitriev
Posts: 9
Joined: 01 Jun 2023 09:11

Re: Alignment greater than 16 - how to set without warnings?

Unread postby AndreyDmitriev » 26 Sep 2025 04:25

Thank you very much, this is exactly what I needed. I had already tried explicit declaration of the sections, but I used the wrong syntax and was not aware of auto segmentation. Now I understand how it should be and it works.

Who is online

Users browsing this forum: No registered users and 0 guests