From: Junio C Hamano <gitster@pobox.com>
To: Kyle Lippincott <spectral@google.com>
Cc: git@vger.kernel.org
Subject: Re: libification: how to avoid symbol collisions?
Date: Tue, 13 Feb 2024 08:50:15 -0800 [thread overview]
Message-ID: <xmqqr0hg8g1k.fsf@gitster.g> (raw)
In-Reply-To: <CAO_smVizKLL2NHFBpszJn+ieJhCEZyvvOT-BWv6Oz5pGiafPVg@mail.gmail.com> (Kyle Lippincott's message of "Mon, 12 Feb 2024 18:48:26 -0800")
Kyle Lippincott <spectral@google.com> writes:
> struct/enum/typedef/union names. That's going to be quite annoying to
> maintain; even if we don't end up having to do all 3,500 symbols, for
> the files that are part of some public library, we'd add maintenance
> burden because we'd need to remember to either make every new function
> be static, or add it to this list. I assume we could create a test
> that would enforce this ("static, named with <prefix>, or added to
> <list>"), so the issue is catchable, but it will be exceedingly
> annoying every time one encounters this.
No matter how we do this, we'd need to maintain that list, so the
choices are between "#define" and "objcopy --redefine-sym" if we
limit ourselves to static linking, I think. The former may be more
portable but makes me feel dirty. The debuggers will not see the
names we want to use, for one thing. "rename selected symbols in *.o
files" approach, if it can be done on platforms we want the lib thing
on, would be more preferable.
We also should be able to create a single linkable object (e.g., Z.o
out of X.o and Y.o from the previous example---it could be Z.so that
is dynamically linked at runtime) to resolve the symbols that need
to be shared only among the object files (like "foo" that is defined
in X.o whose address is needed in Y.o) and after such a linking is
done, these "internal" symbols can be stripped away from the
resulting object file. For that, we'd also need to maintain that
list of internal symbols that are needed in order to link our
objects together.
prev parent reply other threads:[~2024-02-13 16:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 2:30 libification: how to avoid symbol collisions? Kyle Lippincott
2024-02-09 13:31 ` rsbecker
2024-02-13 1:02 ` Kyle Lippincott
2024-02-09 17:09 ` Junio C Hamano
2024-02-13 2:48 ` Kyle Lippincott
2024-02-13 16:50 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr0hg8g1k.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=spectral@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox