[PATCH 4/4] libctf: get the offsets of fields of unnamed structs/unions right
Nick Alcock
nick.alcock@oracle.com
Thu Apr 6 11:46:45 GMT 2023
On 27 Mar 2023, Alan Modra stated:
> On Mon, Mar 27, 2023 at 11:27:40AM +0100, Nick Alcock wrote:
>> Are they all 32-bit platforms? It looks like it.
>
> Yes, and built on x86_64-linux. Which is why things go wrong.
> "lookup" is compiled and running on x86_64, thus compiled in offsets
> are for the 64-bit host. The test objects are compiled by the
> relevant target compiler, in this case all 32-bit. Things would break
> with a 32-bit host and 64-bit targets too of course.
I have a fix under test that just turns this test off when
cross-compiling. It just doesn't make sense to assume that datatypes
have similar sizes on distinct platforms, regardless of the state of
some woolly generality like "bitness". I suppose I could use the same
tricks Autoconf does to get sizeof()s without execution, but for this
test that feels like total overkill. This isn't a cross-compilation bug,
it bites everywhere, so native-only tests will suffice to stop it
returning.
>> I'll take a look. Maybe I can just make the test less picky -- all we're
>> actually interested in for this bug is "CTF says 0". But this is worthy
>> of investigation regardless. It's just as likely to be a compiler bug
>> as a bug in libctf, I'd guess.
>
> It's funny how we tend to not suspect the test. :)
At least that's usually fixable with better ways to run the testsuite
that spot bugs in the tests :) This round of fixes is taking longer than
I'd hoped because valgrind and ASAN spotted uninitialized data usage and
memory leaks in a new test...
(I really should put the pile of scripts that controls my tests online
somewhere: even if some of them rely on things like homebrew
containerization hacks and so won't run without modification, the
combination might still be valuable. These days they're mostly run under
pueue, a rather nice queueing system for noninteractive programs.)
--
NULL && (void)
More information about the Binutils
mailing list