Hi!
> On 30 Oct 2023, at 08:22, gz8...@0w.se wrote:
> 
> Hello Reimar,
> 
>> because it's a lot uglier and less relevant than the
>> changes I have done previously.
>> So comments or objections welcome.
> 
> It would be helpful if adding code to tcc is accompanied with the
> description of the problems the addition is supposed to solve.

Right, I should explain in commit message.

> The "thin archive" functionality is a means to somewhat optimize certain
> kind of builds (those who use large build-time libraries never becoming
> a part of the final data).

Yes, it avoids the IO and disk space of copying the .o files into the .a file.
However for that goal, tinycc maybe would need to be able to create them as 
well.
My reason for implementing it is compatibility.
Quite a few projects will default to thin archives, and if you configure them
for CC=tcc they will fail to compile because of it.
They test for ar support of thin archives, but I don't think any of them
test if the compiler supports it...
Now setting AR="tcc -ar" generally works, but it's an extra hurdle for
trying to get a project to compile.
Though maybe just detecting thin archives (instead of just saying that
the format is not recognized) and printing instructions may work well enough
as an alternative.

> That's nice if tinycc will be able to efficiently build huge targets,
> but adding features is usually irreversible and each addition makes tiny
> to less tiny.
> 
> Would it be too much to ask for making this addition a compile-time choice?

Since the reason for it is compatibility, not a new feature per se,
I would not like that.
For compatibility features not having it at all (and force
people to deal with it) might be better than having it conditional.

> (without having read into the code, a detail:
> in the snippet
>         if (0 == memcmp(h, ARMAG, 8))
>             return AFF_BINTYPE_AR;
> +        if (0 == memcmp(h, "!<thin>\n", 8))
> +            return AFF_BINTYPE_AR;
> "!<thin>\n" looks like a candidate for a symbolic name not unlike ARMAG ?)

It seemed overkill at first since it was only used in one place,
but now that it's used in 2 places, yes.

Best regards,
Reimar

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to