[Toybox] Impact of global struct size

Ray Gardner raygard at gmail.com
Tue Jan 2 14:58:54 PST 2024


On Mon, Jan 1, 2024 at 1:39 PM Rob Landley <rob at landley.net> wrote:
> ... [ a very long and detailed reply ] ...

Rob, thank you for the "GIANT INFODUMP", and I mean that sincerely. It
took me a while to read it; it must have taken quite a while to write it.
A lot of info on kernel-level memory management, I think I got about 90%
of it but I'll have to look up some stuff (PLT, GOT, ...).

> yes "ELF format" is like "ATM machine"

where I use my PIN code?

One bit I can contribute: BSS is an assembler directive dating back at
least to the 1960s and probably earlier (don't ask me how I know). It was
used to reserve uninitialized space; BSSZ was used to reserve space zeroed
out at load time. Don't know if it's in any current assemblers.

I tried inserting a printf of sizeof(TT) and find that it does report only
the global size of my own toy. I should have tried that before I asked
about it, and looked at how TT is defined. (I was thinking it was the
entire "this" union but obviously it could not be, given how globals are
accessed in each toy. Braino...)

I know you aren't too big on using "const", but you said (implied?) it
could put data into the rodata section. For example, would it be
beneficial to do this:

static char const * const msg = "a message";
static char const * const msgs[] = { "msg1", "msg2", 0 };

Ray


More information about the Toybox mailing list