This is the mail archive of the binutils@sources.redhat.com 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: HELP with linker script!!!


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




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