* [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields
@ 2020-03-12 12:15 david.marchand at redhat dot com
2020-04-29 13:30 ` [Bug default/25661] " dodji at redhat dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: david.marchand at redhat dot com @ 2020-03-12 12:15 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
Bug ID: 25661
Summary: [libabigail] incorrect handling of anonymous
struct/union fields
Product: libabigail
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: default
Assignee: dodji at redhat dot com
Reporter: david.marchand at redhat dot com
CC: libabigail at sourceware dot org
Target Milestone: ---
This had been caught by a patchset submitted in the dpdk project.
Here is a reproducer:
$ cat plop.c
#include <inttypes.h>
struct _export {
#ifdef BEFORE
uint64_t marker[0];
uint64_t a;
uint64_t b;
#else
union {
uint64_t marker[0];
struct {
uint64_t a;
uint64_t b;
};
};
#endif
uint64_t c;
};
extern void set_a(struct _export *sym);
void set_a(struct _export *sym)
{
sym->a = 1;
}
$ cat Makefile
CC ?= gcc
CFLAGS ?= -Wall -Werror -g
ABIDIFF = abidiff
before_%.o: %.c
$(CC) $(CFLAGS) -DBEFORE -o $@ -c $<
pahole $@
after_%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
pahole $@
dump: before_plop.o after_plop.o
$(ABIDIFF) $^
[dmarchan@wsfd-netdev66 struct_anon_field]$ rm *.o; make
cc -Wall -Werror -g -DBEFORE -o before_plop.o -c plop.c
pahole before_plop.o
struct _export {
uint64_t marker[0]; /* 0 0 */
uint64_t a; /* 0 8 */
uint64_t b; /* 8 8 */
uint64_t c; /* 16 8 */
/* size: 24, cachelines: 1, members: 4 */
/* last cacheline: 24 bytes */
};
cc -Wall -Werror -g -o after_plop.o -c plop.c
pahole after_plop.o
struct _export {
union {
uint64_t marker[0]; /* 0 0 */
struct {
uint64_t a; /* 0 8 */
uint64_t b; /* 8 8 */
}; /* 0 16 */
}; /* 0 16 */
uint64_t c; /* 16 8 */
/* size: 24, cachelines: 1, members: 2 */
/* last cacheline: 24 bytes */
};
abidiff before_plop.o after_plop.o
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function void set_a(_export*)' at plop.c:21:1 has some indirect sub-type
changes:
parameter 1 of type '_export*' has sub-type changes:
in pointed to type 'struct _export' at plop.c:3:1:
type size hasn't changed
2 data member deletions:
'uint64_t _export::marker[]', at offset 0 (in bits) at plop.c:5:1
'uint64_t _export::b', at offset 64 (in bits) at plop.c:7:1
1 data member change:
data member uint64_t _export::a at offset 0 (in bits) became anonymous
data member 'union {uint64_t marker[]; struct {uint64_t a; uint64_t b; };}'
make: *** [Makefile:14: dump] Error 4
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] incorrect handling of anonymous struct/union fields
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
@ 2020-04-29 13:30 ` dodji at redhat dot com
2020-04-29 13:31 ` dodji at redhat dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dodji at redhat dot com @ 2020-04-29 13:30 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #1 from dodji at redhat dot com ---
Thank you for filing this issue.
I have been working on it and the work-in-progress code is in the branch at
dodji/PR25661 at
https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/dodji/PR25661.
You can check it out by doing:
git clone -b dodji/PR25661 git://sourceware.org/git/libabigail.git
libabigail/PR25661
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] incorrect handling of anonymous struct/union fields
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
2020-04-29 13:30 ` [Bug default/25661] " dodji at redhat dot com
@ 2020-04-29 13:31 ` dodji at redhat dot com
2020-04-29 13:32 ` dodji at redhat dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dodji at redhat dot com @ 2020-04-29 13:31 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
--- Comment #2 from dodji at redhat dot com ---
Here is what the code of the dodji/PR25661 branch does so far, on the example
submitted in this problem report:
$ diff -u test5-v0.c test5-v1.c
--- test5-v0.c 2020-04-29 15:27:48.928684182 +0200
+++ test5-v1.c 2020-04-29 15:26:47.431127898 +0200
@@ -2,9 +2,15 @@
struct S
{
- uint64_t marker[0];
- uint64_t a;
- uint64_t b;
+ union
+ {
+ uint64_t marker[0];
+ struct
+ {
+ uint64_t a;
+ uint64_t b;
+ };
+ };
uint64_t c;
};
$ build/tools/abidiff test5-v0.o test5-v1.o
Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added
function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
$ abidiff --harmless test5-v0.o test5-v1.o
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C] 'function void func(S*)' at test5-v1.c:18:1 has some indirect sub-type
changes:
parameter 1 of type 'S*' has sub-type changes:
in pointed to type 'struct S' at test5-v1.c:3:1:
type size hasn't changed
data members 'S::a', 'S::marker', 'S::b' were replaced by anonymous
data member:
'union {uint64_t marker[]; struct {uint64_t a; uint64_t b;};}'
$
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] incorrect handling of anonymous struct/union fields
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
2020-04-29 13:30 ` [Bug default/25661] " dodji at redhat dot com
2020-04-29 13:31 ` dodji at redhat dot com
@ 2020-04-29 13:32 ` dodji at redhat dot com
2020-04-29 16:37 ` david.marchand at redhat dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dodji at redhat dot com @ 2020-04-29 13:32 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
--- Comment #3 from dodji at redhat dot com ---
I am doing more testing and reviewing of the code base, but if you have time,
you might want to test it as well. I'll hopefully be able to submit the change
soon once I am done with the testing and cleanup.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] incorrect handling of anonymous struct/union fields
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
` (2 preceding siblings ...)
2020-04-29 13:32 ` dodji at redhat dot com
@ 2020-04-29 16:37 ` david.marchand at redhat dot com
2020-05-18 9:38 ` [Bug default/25661] [libabigail] Handle data member replacement by anonymous data members dodji at redhat dot com
2020-05-18 12:28 ` dodji at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: david.marchand at redhat dot com @ 2020-04-29 16:37 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
--- Comment #4 from David Marchand <david.marchand at redhat dot com> ---
Works for me.
Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] Handle data member replacement by anonymous data members
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
` (3 preceding siblings ...)
2020-04-29 16:37 ` david.marchand at redhat dot com
@ 2020-05-18 9:38 ` dodji at redhat dot com
2020-05-18 12:28 ` dodji at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: dodji at redhat dot com @ 2020-05-18 9:38 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Summary|[libabigail] incorrect |[libabigail] Handle data
|handling of anonymous |member replacement by
|struct/union fields |anonymous data members
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug default/25661] [libabigail] Handle data member replacement by anonymous data members
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
` (4 preceding siblings ...)
2020-05-18 9:38 ` [Bug default/25661] [libabigail] Handle data member replacement by anonymous data members dodji at redhat dot com
@ 2020-05-18 12:28 ` dodji at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: dodji at redhat dot com @ 2020-05-18 12:28 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=25661
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from dodji at redhat dot com ---
This should now be solved in the master branch by patches from
https://sourceware.org/git/?p=libabigail.git;a=commit;h=48f26ddc00164bd0add63f933ade44e6327121a6
to
https://sourceware.org/git/?p=libabigail.git;a=commit;h=5eb4d7627acb52daab6122fd8735362bbeaf19d3.
It should be available in the coming 1.8 version of Libabigail.
Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-18 12:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 12:15 [Bug default/25661] New: [libabigail] incorrect handling of anonymous struct/union fields david.marchand at redhat dot com
2020-04-29 13:30 ` [Bug default/25661] " dodji at redhat dot com
2020-04-29 13:31 ` dodji at redhat dot com
2020-04-29 13:32 ` dodji at redhat dot com
2020-04-29 16:37 ` david.marchand at redhat dot com
2020-05-18 9:38 ` [Bug default/25661] [libabigail] Handle data member replacement by anonymous data members dodji at redhat dot com
2020-05-18 12:28 ` dodji at redhat dot com
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).