This is the mail archive of the
mailing list for the binutils project.
Re: symbol size as function size
- From: Nick Clifton <nickc at redhat dot com>
- To: "Paulo J. Matos" <pocmatos at gmail dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 24 Jun 2011 09:29:38 +0100
- Subject: Re: symbol size as function size
- References: <email@example.com>
.equ __size_of_sum, .-sum
__size_of_sum would then be used as a symbol containing the size in
words of sum.
The problem with the current setup is that as sets the value of
__size_of_sum and when it is relaxed at link time, the size tends to
decrease so the final value of __size_of_sum is wrong.
You do not say for which target(s) you are having this problem.
Alan has already mentioned one way of solving the problem. Here is
another - the cause is probably that the assembler is computing the
value of ". - sum" rather than leaving it to the linker. In order to
prevent this you need to define md_allow_local_subtract and have it
decide when it is necessary to postpone the calculation until link time.