public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@seketeli.org>
To: Ben Woodard <woodard@redhat.com>
Cc: "Giuliano Procida" <gprocida@google.com>,
	libabigail@sourceware.org,
	"Matthias Männich" <maennich@google.com>
Subject: Re: [PATCH 3/3] ir: Consider integral types of same kind and size as equivalent
Date: Fri, 19 Aug 2022 17:30:59 +0200	[thread overview]
Message-ID: <87y1vkl07g.fsf@seketeli.org> (raw)
In-Reply-To: <1022329F-61A4-4E74-B449-D582A929515F@redhat.com> (Ben Woodard's message of "Thu, 18 Aug 2022 10:52:27 -0700")

Hello,

Ben Woodard <woodard@redhat.com> a écrit:

> I do not believe applying the fundamental type folding only to self
> comparison will meet our needs. The real reason that self comparison
> is important to us is we need to throw away the binary and then save
> the abixml. Then later on we can compare the abixml to a new build to
> find out if something happened that broke ABI. Thus for our needs, we
> will not be in a self comparison operation at the time when we come
> across this in a non-testing environment. I believe that the ordering
> of the TUs that make up the binary could make this problem appear,
> thus I do not think it will serve our purposes.

OK.

> I know that C doesn’t have a ODR but I’m fairly certain that code
> along the lines of what is in btrfs-progs will have portability
> problems between architectures. Therefore, I think that programs like
> this should be fixed. I’m start a discussion with the btrfs guys and
> explain the problem. I can imagine a possible reason for this problem
> in btrfs-progs though, it could be caused by the need to read a FS
> created on one arch on a machine of another arch. I ran into that a
> few times many years ago and worked with upstream to fix them. (Ia64
> era IIRC)
>
> However, the fact that libabigail catches this problem is far too
> late. At the very least I’d say the compiler should warn about issues
> like this. We should talk to the compiler guys and see if we can have
> them create a warning about this situation.

This is a well known problem in the compiler space.  G++ now has the
-Wno-odr warning to detect ODR violation and emit a warning.  But that's
for C++.

For C however, I am not sure.


> Dodji could you start a discussion with our compiler team on this and
> I will weigh in on it.

Yeah, I'll see what I can do.

> As for libabigail, this problem is too subtle for a normal user to
> understand given the current output and so we need to do
> something. When reading a corpus of a binary when you come across a
> case where two different typedefs from two different TUs have
> different types but the ABI of the fundamental type is compatible, you
> should emit a warning saying something like: “two typedefs types from
> different TUs have conflicting types. ABI comparisons cannot be
> reliably done. file1.c:<line no> and file2.c:<line no>“. So basically
> at the place where you currently fold the fundamental integral types
> in this patch if they are ABI compatible, print a warning
> instead. That will let me know what the problem is when I do a test
> run and I will report it to the upstream package rather than you. I’ll
> try to fix the world and it won’t be your problem.

Emitting a comment that makes sense would be nice, indeed.  But I'll
need to tackle this separately because it's not exactly a one
liner. There can be a lot of types being in that case, just because they
happen to use a type that exhibits the problem.  We need to emit the
comment just for the type that is at the root cause of the problem.  So
it takes a little bit of thinking, I think.

Also, I might have a way to handle this in a way that enable us to
represent those ODR-violating types regardless.  I don't like how
libabigail is fragile here.  But I need to play with the idea a little.
And I might be wrong.  I think this topic needs some more hashing out.

> Maybe have a big comment near the logic in the DWARF reader or where this is detected that explains the decision for the next guy. 
>
> So in summary: 
> 1) Revert or replace this patch and add warning to libabigail. That should satisfy both me and Giuliano. 


OK, I have just done this.  The patch is https://sourceware.org/pipermail/libabigail/2022q3/004666.html.

> 2) Start a discussion with the GCC folk about adding a warning. I’ll follow up.
> 3) I’ll use the GCC warning discussion to bring this up with upstream btrfs people and possibly suggest a patch to fix their stuff.

As I said above, I need to think about this a little bit more.

> 4) I’ll do the same with any other packages that have a similar problem.

Yeah.  The problem though is that it needs very careful debugging to
understand the problem.  That is where your point about libabigail
emitting a warning makes sense.

Thank you for your handling this.

[...]

Cheers,

-- 
		Dodji

      reply	other threads:[~2022-08-19 15:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 23:19 [PATCH 0/3] Make integral types of same base and size compatible Dodji Seketeli
2022-07-22 23:28 ` [PATCH 1/3] ir: Disambiguate sorting of array element types Dodji Seketeli
2022-07-22 23:31 ` [PATCH 2/3] dwarf-reader: Remove redundant qualifiers from qualified types Dodji Seketeli
2022-07-22 23:32 ` [PATCH 3/3] ir: Consider integral types of same kind and size as equivalent Dodji Seketeli
2022-08-10 15:23   ` Giuliano Procida
2022-08-11  2:22     ` Ben Woodard
2022-08-12 15:26       ` Giuliano Procida
2022-08-16 19:56         ` Ben Woodard
2022-08-16 16:54     ` Dodji Seketeli
2022-08-16 17:06       ` Ben Woodard
2022-08-16 18:10       ` Giuliano Procida
2022-08-18 16:29         ` Dodji Seketeli
2022-08-18 17:52           ` Ben Woodard
2022-08-19 15:30             ` Dodji Seketeli [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=87y1vkl07g.fsf@seketeli.org \
    --to=dodji@seketeli.org \
    --cc=gprocida@google.com \
    --cc=libabigail@sourceware.org \
    --cc=maennich@google.com \
    --cc=woodard@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).