This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: symbol size as function size


Hi Paulo,

.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.

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]