Replies: 2 comments 2 replies
-
Ooh, cmake. You're brave! Regarding the libc file structure: you're right, it's not by header file, which is intentional. The C headers combine portable functions and non-portable functions in the same file. Consider that stdio contains rename, which is a system call supplied by the plat, and fopen, which is supplied by the libc. So, they're divided up correspondingly, more or less by function. Regarding ISO C90: no, it's not --- it's more like Posix (although not a very new Posix, and with rather hit-and-miss coverage). What's the value of ISO C90? It's very restrictive... The C99isms were added because it was little work and allows clearer code. Regarding the cmake optin: the way the ACK is supposed to work is that it builds all the combinations of all the platforms (this is one of the things which cmake isn't good at). So if you wanted a strict C90 variant, it'd be more fitting to either build each libc twice and allow the user to select which one to use as an ack command line flag, or else (which is probably preferable, and much less work) to use #define feature macros to let to the user configure the C library. That would first require someone to look at the headers and figure out which standard they're roughly conforming to, which hasn't been done yet. (I'm not averse to rearranging the libc if it'll help things, but there are actually reasons why it's arranged the way it is.) |
Beta Was this translation helpful? Give feedback.
-
Right now I'm not sure if any plats actually do override the libc. The way to do it would be to put the override functions into another library and make sure it appears before the libc in the link order, so that by the time the linker sees the libc, those functions are resolved. I'd need to check to make sure it works, though. The intention is that a plat need only implement a very small number of functions for the base system calls, and then the libc would do the rest. Look at plat/pc86/libsys. The only functions there which actually do anything are brk/sbrk, read/rawread, and write/rawwrite. I don't really know how that could be simplified! Regarding building with cmake... this sounds like it would require many passes through cmake; one for the host tools, and then one for each plat (and plat variant). That seems to me to be incredibly cumbersome. I know the current build scripts are bad (I have a much better replacement ready to go), but I would think this would be worse. |
Beta Was this translation helpful? Give feedback.
-
Greetings,
After 4 years of silence, I am back trying to compile ACK with CMake, and its going fairly better than last time...
I am currently at the platform building phase and by evaluating the libc source code and the different platform rules, i see a lot of things which causes some
confusion and would like to discuss:
(header file)
Hence i propose the following in my upcoming patch in my fork:
of the above extensions
directory (misc should no longer exist), and have the same mirror
under libcc.ansi/sys
What do you think? The idea is to also mirror this libc directory structure for each platform that wish to override some of the C functions.... For example for stdlib:
The two last directories are optional and only present for example if you wish to override some functions of stdlib.c... Hence the search for the source files would be in reverse order of this list.
Any comments?
Carl
Beta Was this translation helpful? Give feedback.
All reactions