Map File . = ALIGN (0x2)

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Map File . = ALIGN (0x2)

Post by Jhysaun »

Does anyone know what ". = ALIGN (0x2)" means in a map file?
Whatever it is, it always seems to have a size of 0, so I doubt it does anything important.

Thanks
>J
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.
User avatar
filipe
Posts: 42
Joined: Thu Dec 17, 2009 10:37 pm
Location: Cambridge, UK

Re: Map File . = ALIGN (0x2)

Post by filipe »

Jhysaun wrote:Does anyone know what ". = ALIGN (0x2)" means in a map file?
Whatever it is, it always seems to have a size of 0, so I doubt it does anything important.

Thanks
>J
". = ALIGN(2)" means: current address (the dot ".") receives the current address aligned in two bytes.
If it is reporting zero, good, the address is already aligned, there is no problem.

Normally is used when you really need make sure some block of your code/data will be aligned. It is used too for performance issues (like match with the cache line).

I was compiling some ARM code and added the align to make a example for you:

Code: Select all

 .bss           0x20000038        0x0 build/queue.o
                0x2000003a                . = ALIGN (0xa)
 *fill*         0x20000038        0x2 00
I put an ALIGN(10) statement at the end of the .bss section. As you can see, the linker added 2 extra bytes :)

-Filipe Rinaldi
User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Re: Map File . = ALIGN (0x2)

Post by Jhysaun »

Thanks Filipe =D


>J
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.
Post Reply