[arm-gnu] LD - how to check memory size
42Bastian
list-bastian.schick at sciopta.com
Thu Apr 12 16:44:09 UTC 2012
Hi Vaclav
>> Am 12.04.2012 13:55, schrieb Vaclav Peroutka:
>>> Hello,
>>>
>>> I have simple linker script like below. If I have two sections, they
>>> are
>>> collected correctly but size is not counted? Does anybody know, why ? It
>>> was disappointing when we found this feature. BTW. Is it feature, or bug
>>> in the script or in the linker ? How to correctly rewrite the script to
>>> have more sections and size checking ? If I have everything in one
>>> section, checking of course works.
>>
>> Your question is a bit confusing. Which size is not counted? Maybe you
>> stripped to much from the script?
>>
>> Did you try ASSERT() and SIZEOF() ?
>>
>
> If sec1 and sec2 sizes are bigger than MEM1 size, I got no warning, no error. If I put everything into one sections, I get linker error, which is correct. Hopefully now it is cleaner.
Now this sounds weired. (Esp. as I rely on this feature in my scripts)
> I did not try neither ASSERT nor SIZEOF. Can you give me some example ?
Well, this should work:
ASSERT(SIZEOF(.sec1)+SIZEOF(.sec2)<= LENGTH(MEM1))
(I am always unsure how the test in assert should look like.)
--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
More information about the arm-gnu
mailing list