[U-Boot] [PATCH 2/2] RFC: Let linker create phy array

Albert ARIBAUD albert.u.boot at aribaud.net
Mon Feb 6 21:53:17 CET 2012


Le 05/02/2012 21:40, Mike Frysinger a écrit :
> On Sunday 05 February 2012 08:26:57 Albert ARIBAUD wrote:
>> Le 05/02/2012 04:38, Mike Frysinger a écrit :
>>> On Saturday 04 February 2012 22:02:46 Troy Kisky wrote:
>>>> --- a/include/phy.h
>>>> +++ b/include/phy.h
>>>>
>>>> +extern struct phy_driver __phy_entry_start, __phy_entry_end;
>>>
>>> linker symbols should be declared like:
>>> 	extern char __phy_entry_start[];
>>
>> Why should they?
>
> because that's what the GNU linker documentation says to, and that's how all
> existing symbols have been handled.  look at asm/sections.h in every Linux
> arch.

Does it? What I read from 
<http://sourceware.org/binutils/docs-2.22/ld/Source-Code-Reference.html#Source-Code-Reference> 
never says that linker-defined symbols should be declared in source code 
as char[]; actually, it gives examples where linker-defined symbols are 
defined with types int and char, not char[].

What the section says, OTOH, is that one must remember that the linker 
will not allocate space for a symbol unless explicitly instructed to, so 
such symbols my not have meaningful values, only addresses, and the code 
should access these symbols by address -- which is what is being done in 
the code of the RFC patch IIUC.

> -mike

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list