[Prism54-devel] New FreeMAC snapshot
Denis Vlasenko
vda at ilport.com.ua
Tue Sep 27 07:13:47 UTC 2005
On Monday 26 September 2005 21:20, Sebastien wrote:
> > I made a patch which allows for freemac compilation without
> > any support from C library. I simply added all required
> > C functions to libc.c.
>
> Thanks for the patch ! That's a good idea, since it will allow us to
> remove unneeded code in the libc as the space is very limited.
>
> > Division/modulo asm routines are in disi.s.
> > Name is from "di" - 64bit ones and "si" -32bit ones).
> > If you don't like it, feel free to rename (libc_asm.s?).
>
> Ok for the name.
>
> > I wasn't able to find comprehensible source of these
> > routines in newlib (too convoluted with macros) and thus
> > I obtained them just by disassembling a test program
> > with one division and one modulo.
>
> That's *very* dirty, from the technical point of view ("static" code
Yes. I just was trying to push the thing through. Will clean up.
> which won't match the compiler flags, hard to understand and to modify
> code) as well from the philosophical point of view (can we really call
> that kludge "free and open source software" ?).
Well if newlib's _source_ is available, then disasmed binaries can't
be illegal I guess. :)
Division code is compiled with newlib and thus does not rely on gcc flags
when you compile something against newlib headers (newlib's object code
already exists at this point, gcc does not regenerate it).
> Can't we get those functions somewhere else, if newlib is really
> unreadable ?
I think I can get them from newlib, just need to concentrate more on this.
> > I disabled long long handling in vsnprintf and 64bit
> > routines in disi.s. It adds quite a bit of code
> > (which is going to be a dead code anyway, we won't
> > ever use 64bit ints in freemac I guess).
>
> Perhaps we will, for clocks?
Just look at size of those 64bit division routines!
I'd rather print("%08x%08x", time_hi, time_lo)
in the very few places where we will need it.
> By the way, it's no use to add "#ifdef UNUSED" around functions that are
> never called : the compiler automatically strips them off the resulting
> binary, AFAIK.
You overestimate cleverness of ld.
# cat t.c
void g(void) {}
#ifndef TEST
int f() {
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
g();g();g();g();g();g();g();g();
return 0;
}
#endif
int main() { return 0; }
# gcc -Os t.c; size a.out
text data bss dec hex filename
736 252 4 992 3e0 a.out
# gcc -Os -DTEST t.c; size a.out
text data bss dec hex filename
728 252 4 984 3d8 a.out
> > I think vsnprintf can be moved into libc.c.
>
> Hmm... shouldn't we split the minimal libc into several files ?
Frankly, I do not like when source is dispersed in zillions of tiny
files. It is done for libraries as a anti-ld-lameness measure.
We do not need it.
Example from acx driver: old:
# ls -l acx100-0.2.0pre8_plus_fixes_57/{include,src}
acx100-0.2.0pre8_plus_fixes_57/include:
total 192
-rw-r--r-- 1 root root 187 Apr 20 12:46 acx.h
-rw-r--r-- 1 root root 868 Apr 21 23:57 acx_config.h
-rw-r--r-- 1 root root 11383 Jun 8 11:00 acx_func.h
-rw-r--r-- 1 root root 4070 Jun 2 12:08 acx_inline.h
-rw-r--r-- 1 root root 78362 Jun 8 11:00 acx_struct.h
-rw-r--r-- 1 root root 3468 Apr 20 2004 p80211msg.h
-rw-r--r-- 1 root root 26152 Jan 1 2005 p80211types.h
-rw-r--r-- 1 root root 1968 Apr 13 2004 version.h
-rw-r--r-- 1 root root 8826 Apr 20 12:46 wlan_compat.h
-rw-r--r-- 1 root root 14674 Apr 20 01:05 wlan_hdr.h
-rw-r--r-- 1 root root 17572 Jun 2 12:08 wlan_mgmt.h
-rw-r--r-- 1 root root 3079 Apr 20 00:49 wlan_monitor.h
acx100-0.2.0pre8_plus_fixes_57/src:
total 656
-rw-r--r-- 1 root root 6651 Jun 2 12:08 Makefile
-rw-r--r-- 1 root root 565 Jul 5 2004 Makefile2.6
-rw-r--r-- 1 root root 60382 Jun 8 11:00 acx100.c
-rw-r--r-- 1 root root 18563 Jun 8 11:00 acx100_conv.c
-rw-r--r-- 1 root root 120914 Jun 8 11:00 acx100_helper.c
-rw-r--r-- 1 root root 72360 Jun 2 12:08 acx100_helper2.c
-rw-r--r-- 1 root root 95332 Jun 8 11:00 acx100_ioctl.c
-rw-r--r-- 1 root root 68450 Jun 8 11:00 acx100_usb.c
-rw-r--r-- 1 root root 36173 Apr 20 12:46 acx80211frm.c
-rw-r--r-- 1 root root 70695 Jun 2 12:08 idma.c
-rw-r--r-- 1 root root 25274 Jun 8 11:00 ihw.c
-rw-r--r-- 1 root root 12981 Apr 20 12:46 ihw_usb.c
-rw-r--r-- 1 root root 4573 Apr 7 12:59 ioregister.c
-rw-r--r-- 1 root root 4551 Jun 2 12:08 setrate.c
.h names look saner than .c because I already sent Andreas
(he is a maintainer) a patch to rename them.
current:
# ls -l current
total 648
-r--r--r-- 1 root root 8217 Sep 15 08:09 Changelog
-r--r--r-- 1 root root 1827 Sep 11 00:04 Kconfig
-r--r--r-- 1 root root 325 Sep 11 00:04 Makefile
-r--r--r-- 1 root root 4469 Sep 13 09:14 README
-r--r--r-- 1 root root 140 Sep 11 00:04 acx.h
-r--r--r-- 1 root root 1546 Sep 15 00:15 acx_config.h
-r--r--r-- 1 root root 19697 Sep 22 09:40 acx_func.h
-r--r--r-- 1 root root 68992 Sep 14 21:44 acx_struct.h
-r--r--r-- 1 root root 183024 Sep 14 23:08 common.c
-r--r--r-- 1 root root 14853 Sep 15 11:17 conv.c
-r--r--r-- 1 root root 77336 Sep 11 00:04 ioctl.c
-r--r--r-- 1 root root 134348 Sep 22 09:40 pci.c
-r--r--r-- 1 root root 4533 Sep 11 00:04 setrate.c
-r--r--r-- 1 root root 46245 Sep 25 13:37 usb.c
-r--r--r-- 1 root root 10442 Sep 14 08:36 wlan.c
-r--r--r-- 1 root root 9647 Sep 14 23:09 wlan_compat.h
-r--r--r-- 1 root root 17560 Sep 15 00:13 wlan_hdr.h
-r--r--r-- 1 root root 18304 Sep 13 00:36 wlan_mgmt.h
--
vda
More information about the Prism54-devel
mailing list