[Toybox] FreeBSD Toybox check-in

Rob Landley rob at landley.net
Mon Nov 13 11:58:40 PST 2023


On 11/10/23 18:28, enh wrote:
>     > Yes, top will also be in that group. These ones may be good candidates
>     > for GSoC or intern projects.
> 
>     A trick I've been pondering using is declaring __attribute__((__weak__)) on some
>     functions in toys/*/*.c or lib/*.c that lib/portability.c can have optional
>     alternate implementations of, assuming the --gc-sections trick can make the weak
>     one drop out if a non-weak one gets linked in. (It _should_ do?)
> 
> you don't even need --gc-sections. that's just how weak symbols work.
> 
> maskray (the person i mean any time i say "the linker guy")
> agrees: https://maskray.me/blog/2021-04-25-weak-symbol

Yeah, but is it static transitive?

If I have a weak void hash_by_name(int fd, char *name, char *result) that's
calling static void sha1_transform(struct browns *hash) does sha1_transform()
drop out when that hash_by_name gets replaced?

That's not a theoretical case, that's what lib/hash.c looks like right now as I
ponder implementing a krypt() to replace crypt(). (Well it's not xcrypt()
because it shouldn't exit, and I don't really have a my_blah() prefix
established and the thought does not appeal. And we've established on mastodon
that I should not call it superdog().)

*shrug* Gotta try it and see. And then try it again on llvm...

Rob

P.S. If Clark Kent was from earth and had a dog, he would logically name it
eartho. Unless Kara named the dog? I could see her naming a dog "oh god I am
desperately homesick because I _wasn't_ a baby, I became a displaced refugee at
13 moving from a spacefaring civilization to one that only recently invented the
tractor and everybody I knew is dead and this was never really properly examined
and am I expected to have babies with my cousin, what's the plan here and are we
SURE nobody else made it out..." but shortening it to the old planet's name.


More information about the Toybox mailing list