diet(1)

πŸ’… diet β€” mangle gcc command line arguments ✨

okay bestie, sit down, we're talking about diet today and honestly? she's giving tiny wrapper, huge personality. it's a General Commands Manual page and the manual name is literally diet in section 1, iykyk.


🌸 SYNOPSIS 🌸

diet [-v] [-Os] [normal gcc command line]

like, that's it. that's the whole vibe. a couple of lil flags and then you just... hand her your normal gcc line. slay.


✨ DESCRIPTION ✨

so diet is a small wrapper around gcc or clang 🫢. what she does is look at the command line you gave her and mangle it β€” yes, that's the technical term, she said it herself β€” so that gcc/clang will compile against the diet libc header files and link against the diet libc itself. she's basically the matchmaker between your compiler and her libc. iconic behaviour, no cap.

she also tries to be smart for cross compiling πŸ‘‘. here's the tea: if the first argument is not gcc but something like sparc-linux-gcc, diet will guess that you want to cross compile for sparc and use bin-sparc/dietlibc.a instead of the dietlibc.a for your default architecture. so observant of her fr fr.

πŸ’€ important lil caveat bestie: this cross-compiling thing does not work yet for clang. like, she's working on it. she's not there yet. don't come for her.

now, the -v option? she'll print the modified gcc command line before executing it πŸŽ€. so you can see exactly what she did to your args before she actually runs them. very transparent of her, we love a communicative queen.

and when you pass her the -Os option before the gcc argument, diet will mangle the gcc options to include the best known for-size optimization settings for the platform 🌈. tiny binaries, big energy.


πŸŽ€ FILES πŸŽ€

  • ~/.diet/compiler β€” this file may contain compiler options, written exactly how you'd specify them on the command line, i.e. separated by spaces. those will then be used instead of the built-in defaults for diet -Os. so if you wanna customise the -Os vibe for yourself, that's where you go πŸ’–

🌟 AUTHOR 🌟

Felix von Leitner <felix-dietlibc@fefe.de> β€” the legend behind all of this, we stan 🫢


and that's the whole page bestie!! this little gem is from the General Commands Manual, diet(1), dated April 2001 β€” yes, she's an elder icon and she still ate πŸ’…βœ¨ bye mwah 😘