[U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

Tom Rini
2012-09-18T20:50:05Z

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 12:25, Marek Vasut wrote:
> Dear Tom Rini,
>
>> On 09/18/12 12:19, Marek Vasut wrote:
>>> Dear Tom Rini,
>>>
>>>> On 09/18/12 11:33, Marek Vasut wrote:
>>>>> Dear Scott Wood,
>>>>
>>>> [snip]
>>>>
>>>>>> I think I got some wires crossed and was thinking about
>>>>>> printf/puts. We want those to be optimized away at
>>>>>> compile time (not pointed to a stub at link time) on an
>>>>>> SPL that has no output support, but once that's done the
>>>>>> low level serial functions shouldn't be referenced
>>>>>> anymore, right?
>>>>>
>>>>> But if you point them to stubs, that's OK. The compiler
>>>>> will GC these useless stubs anyway. But wait, we're getting
>>>>> to LTO here, right?
>>>>>
>>>>> So the safest bet really is macro in serial.h ?
>>>>
>>>> Due to the gcc bug I've mentioned before, yes. Dummy
>>>> functions will, I bet, keep the string constants around. do
>>>> {} while(0) will drop them out entirely.
>>>
>>> Damn, not much gain on m28evk (with C functionss/with macros),
>>> using gcc 4.7.1:
>>>
>>> Configuring for m28evk board... text data bss dec
>>> hex filename 418994 7780 288632 715406 aea8e ./u-boot
>>> 11773 788 12 12573 311d ./spl/u-boot-spl
>>>
>>> Configuring for m28evk board... text data bss dec
>>> hex filename 418998 7780 288628 715406 aea8e ./u-boot
>>> 11765 788 12 12565 3115 ./spl/u-boot-spl
>>
>> Right, didn't have many strings. But do you see what I mean now
>> about not needing this patch as it stands currently?
>
> No, I don't. If I remove this patch, the build breaks either
> because serial_* is defined twice or not defined at all.

m28evk currently, needlessly, defines serial_puts/putc. I locally
patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
and the references in common/libcommon.o are correctly
garbage-collected. They are in fact unused functions today as they're
garbage collected without patching, see spl/u-boot-spl.map after
building. So again I say, if common/serial.o is NOT being discard in
your series on m28evk there is a bug in your series to fix or a change
to better understand and document (and then see if we can change since
as Scott notes, this needs to work for 4kb boards and that is tight).

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWN59AAoJENk4IS6UOR1WtG0P/iYMxTtr0X/F6RRhZ9sLlSNt
pj6o+MTd9eO4e64+0A/jyXDuFd9NBvYdsjBKz8iyQFOrUYAyCdKdl+MZ+E3sD57O
gHKVXcfnMS2jnXTvKMabn4Ddjl8FVjLz+YGXFcwqBpcN5KjuyRKJnl4jntrj8QgK
1d9aqYwnQcMbP36ApPS1WRGotAlydhmL9Bw++ebk+j28iBs1KZWiFK1RUCYc1b5T
bverqK4EQTMxOh8KJNvGs5J61bO1BUA3fWHv2kzKo4XEr+XjRkoFVXDb1Tjf1Xlw
ZDaaky+zyq7D4zwZUFJxseDN7dBTuAYNoYj5UhYvkbTO04s60vKzhyuLMDWxyHrx
ABrmisfWB44K6sjQKZUTBvO6gajA8fe9kTg/uaMaG+9h9xyM0oNBfDmDd7/CK6PE
Mi7q9TJ7cOh1DgHrzSrLaO8n5cam4B3XecLH5Rj1uOA5HHCnKExIxWTdeEg4w63b
VQVdgQ7g/2x8TINdjz9oo1B79n+yHlmIHzc64ZNnBAJhVDKM9h9h6FarAvfwLM1B
Ns/vUCrM17vsaduNcvD0ZGDZSk4MOc8dfPLqfLe9rzFH4VAEmTV8qEaFjnbeORiD
jknV1mLAYD1A/eu1AHdwE58OgPgCTKyYxLA4bE/Yldxy1L+E5DUx+nmOnrCNWPPm
dqdGjBg7P4HHZo2mw6oZ
=QI/g
-----END PGP SIGNATURE-----