unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <codonell@redhat.com>
To: Florian Weimer <fw@deneb.enyo.de>,
	Sandra Loosemore <sandra@codesourcery.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Florian Weimer <fweimer@redhat.com>,
	libc-alpha@sourceware.org, Szabolcs Nagy <szabolcs.nagy@arm.com>,
	cltang@codesourcery.com, andrew@codesourcery.com
Subject: Re: [review v3] slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25...
Date: Tue, 12 Nov 2019 17:14:49 -0500	[thread overview]
Message-ID: <320362b6-854f-230e-5db8-af20f66ef838@redhat.com> (raw)
In-Reply-To: <87r22dey2c.fsf@mid.deneb.enyo.de>

On 11/12/19 1:42 PM, Florian Weimer wrote:
> * Sandra Loosemore:
> 
>> I don't have any state on this particular change or what it is trying to 
>> accomplish, but the linker error is the sort of thing that happens when 
>> the compiler sees a reference to an object it thinks will be put in the 
>> small data section, but the actual definition of the object puts it 
>> somewhere else (e.g., because it is too big for small data) -- in this 
>> case the .bss section.  Are there conflicting declarations about the 
>> size of the object?  If that's unavoidable for some reason, another way 
>> to suppress GP-relative addressing on this object would be to give it an 
>> explicit .bss section attribute everywhere it's declared.
> 
> Thanks for providing this information.  Here is a small reproducer:
> 
> enum { size = 100 };
> 
> struct flexible
> {
>   int length;
>   int data[];
> };
> 
> struct inflexible
> {
>   int length;
>   int data[size];
> };
> 
> static struct flexible flexible =
>   {
>    .data = { [size - 1] = 0, }
>   };
> 
> static struct inflexible inflexible =
>   {
>    .data = { [size - 1] = 0, }
>   };
> 
> struct flexible *
> get_flexible (void)
> {
>   return &flexible;
> }
> 
> struct inflexible *
> get_inflexible (void)
> {
>   return &inflexible;
> }
> 
> It results in:
> 
> 	.file	"t.c"
> 	.section	.text
> 	.align	2
> 	.global	get_flexible
> 	.type	get_flexible, @function
> get_flexible:
> 	addi	r2, gp, %gprel(flexible)
> 	ret
> 	.size	get_flexible, .-get_flexible
> 	.align	2
> 	.global	get_inflexible
> 	.type	get_inflexible, @function
> get_inflexible:
> 	movhi	r2, %hiadj(inflexible)
> 	addi	r2, r2, %lo(inflexible)
> 	ret
> 	.size	get_inflexible, .-get_inflexible
> 	.section	.bss
> 	.type	inflexible, @object
> 	.size	inflexible, 404
> 	.align	2
> inflexible:
> 	.zero	404
> 	.type	flexible, @object
> 	.size	flexible, 404
> 	.align	2
> flexible:
> 	.zero	404
> 	.ident	"GCC: (GNU) 9.2.1 20191101 [gcc-9-branch revision 277712]"
> 
> I think this shows that the backend uses the static type size (as in
> sizeof) to determine whether an object goes into the small data
> section, not the allocated object size.
> 
> The linker only sees the allocated object size, so it places the
> object wrongly (although it could perhaps do something smarter because
> it can see the relocations).
> 
> If the object is not placed into .bss, the choice of .sdata vs .data
> is also based on the static type size, so that would need fixing too.
> 
> I don't know how to work around that in the source code.  My
> preference would be to fix the backend.  I guess we could back out the
> commit and disable the warning for GCC 10 instead.
 
If the new glibc cannot be compiled with gcc8 or gcc9 for nios2, then that's
a problem though. It immediately makes it difficult to test a new glibc on
existing systems without upgrading the system compiler.

If there is a backend bug then it absolutely needs to be fixed, and it looks
like Sandra will try that, but that won't reach the affected compilers until
much much later.

I dislike backing out the changes you made because they are quite nice
cleanups, and the downstream vendors tend to upgrade glibc and gcc and binutils
all in one big group to avoid these issues so I don't expect they will ever
see this problem. It's only us as developers that see the larger version
skew problem.

My inclination is to fix the gcc problem, backport the solution to the active
FSF branches, and then that fixes our testers.

In order of importance:
- Fix all gcc10 issues.
- Fix the nios2 backend issue.
- Backport nios2 backend to active FSF branches.
- Rebuild and test to make sure we are all clean again.

How long will that take and is it OK to leave things in a broken state for that long
for a given target like nios2?

-- 
Cheers,
Carlos.


  parent reply	other threads:[~2019-11-12 22:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 17:11 [review] slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25 Florian Weimer (Code Review)
2019-11-06 16:12 ` Szabolcs Nagy
2019-11-06 16:21   ` Florian Weimer
2019-11-11 15:09     ` Szabolcs Nagy
2019-11-11 15:12       ` Florian Weimer
2019-11-11 21:41         ` Sergio Durigan Junior
2019-11-12 10:22           ` Szabolcs Nagy
2019-11-12 10:35             ` Florian Weimer
2019-11-09 11:44 ` [review v2] " Florian Weimer (Code Review)
2019-11-12 10:40 ` Szabolcs Nagy (Code Review)
2019-11-12 11:47 ` [review v3] " Florian Weimer (Code Review)
2019-11-12 17:29   ` Joseph Myers
2019-11-12 17:42     ` Sandra Loosemore
2019-11-12 18:04       ` Joseph Myers
2019-11-12 18:42       ` Florian Weimer
2019-11-12 20:59         ` Sandra Loosemore
2019-11-13  5:47           ` Florian Weimer
2019-11-13 16:04             ` Sandra Loosemore
2019-11-13 16:25               ` Florian Weimer
2019-11-13 16:06             ` Jeff Law
2019-11-12 22:14         ` Carlos O'Donell [this message]
2019-11-12 22:18           ` Florian Weimer
2019-11-12 22:24             ` Carlos O'Donell
2019-11-12 22:26               ` Florian Weimer
2019-11-12 22:39               ` Joseph Myers
2019-11-13  6:18                 ` Florian Weimer
2019-11-13 16:05             ` Jeff Law
2019-11-12 23:12           ` Sandra Loosemore
2019-11-12 23:15             ` Joseph Myers
2019-11-12 12:53 ` Szabolcs Nagy (Code Review)
2019-11-12 13:00 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-12 13:00 ` Sourceware to Gerrit sync (Code Review)

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=320362b6-854f-230e-5db8-af20f66ef838@redhat.com \
    --to=codonell@redhat.com \
    --cc=andrew@codesourcery.com \
    --cc=cltang@codesourcery.com \
    --cc=fw@deneb.enyo.de \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=sandra@codesourcery.com \
    --cc=szabolcs.nagy@arm.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).