HELP with linker script!!!
Nick Clifton
nickc@redhat.com
Mon Apr 4 13:39:00 GMT 2005
Hi Sergei,
> Well, please correct me if I'm wrong, but I see two problems here.
>
> 1. The variables should better be of type 'char', otherwise pointer
> arithmetic in the third parameter to memcpy() will bring wrong
> result.
>
> 2. Even then it could be wrong. For example, on PowerPC using SYSV ABI
> compiler is free to assume the two variables are in the small data
> section and may generate incorrect assembly and relocation types for
> the addresses, I'm afraid. Because of this I'd use slightly different
> approach:
>
> extern char __start_of_cacheable_bss[];
> extern char __end_of_cacheable_bss[];
>
> memset (__start_of_cacheable_bss, 0,
> __end_of_cacheable_bss - __start_of_cacheable_bss);
>
> The purpose of using arrays of unknown size is to prevent compiler
> from assuming anything about the location of the variables.
Good points - thanks for making them.
Cheers
Nick
More information about the Binutils
mailing list