[Icc-mot] BSS in reverse order?
Jim Fiocca
jim at fiocca.net
Thu Nov 15 05:41:31 PST 2007
The reverse order of the BSS just makes debugging a little awkward.
When I look at a variable or array in memory, I'm used to seeing the
next variable I declared in the file as the next variable in memory.
This just caught me a little off guard and makes debugging a little more
cumbersome. Especially if you want to add a dummy padding array to
force alignment, you have to add it after the object you want to align.
So I was just wondering, from a compiler writer's point of view, why
this was done; because I've never seen it done before.
Thanks,
Jim
Edward Karpicz wrote:
> Jim Fiocca wrote:
>
>> ICC12-V7 questions:
>>
>> 1) In the generated map file (.mp), why are the memory addresses in
>> the BSS section (area) in the reverse order that they were allocated
>> in the program?
>
> Does ANSI C specify the order static vars are allocated? I don't think
> so. For portability and compatibility with future ICC versions, I
> think you shouldn't assume any order of allocation.
> Maybe tell us what are you trying to do? Even structs get not portable
> as soon as someone starts assuming that char is 8 bits or assuming any
> struct packing etc
>
> struct {
> char a;
> short b;
> } ...
>
> ^^ there can be a unused memory space between a and b fields, just
> enable word alignment and see. The same way there can be a unused
> space between statically allocated vars... So are you sure you need
> specific order of allocation?
>
>
>>
>> 2) Is there some sort of data alignment pragma? Or other mechanism
>> to align data on a specific boundary?
>>
>
> There's a word alignment option. If you need specific address then you
> should use abs_address pragma or your custom memory area with specific
> start and end addresses. To get some every >2bytes alignment, I would
> use structs and unions of specific size and custom area to allocate
> only such structs.
> I think you should tell us more about what you are trying to achive.
>
>
> Edward
>
>> Thanks,
>> Jim
>>
>>
>>
>> _______________________________________________
>> Icc-mot mailing list
>> Icc-mot at imagecraft.com
>> http://dragonsgate.net/mailman/listinfo/icc-mot
>>
>
> _______________________________________________
> Icc-mot mailing list
> Icc-mot at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-mot
More information about the Icc-mot
mailing list