public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/96081] New: changed placement of file scope asm() contents
@ 2020-07-06 15:45 jbeulich at suse dot com
  2020-07-07  7:22 ` [Bug inline-asm/96081] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jbeulich at suse dot com @ 2020-07-06 15:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

            Bug ID: 96081
           Summary: changed placement of file scope asm() contents
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at suse dot com
  Target Milestone: ---

>From 9.2 to 9.3 (and presumably then also to 10.1) a change in when, inside the
resulting assembly, file scope asm()-s get output has caused a breakage in one
of the Xen Project's auxiliary tools. What I can observe is that, with any kind
of optimization enabled, all asm()-s get processed first, whereas the data that
we want them to control gets output last.

I realize the output order is really unspecified, but I'd still like to
understand if there's at least a workaround here. What we want to achieve is
control over the ELF type of certain symbols, and this without triggering
modern gas'es "symbol '...' already has its type set" warnings (which the new
behavior not triggers, thus becoming aware of the change in the first place).
Up to gcc 9.2 we simply could put

        .type <symbol>, STT_NOTYPE;
        .type <symbol>, STT_FUNC;

after the data definition and get gcc's respective ".type <symbol>, @object"
overridden this way.

But of course in the more general case it may also be necessary / desirable to
have certain asm()-s take effect _after_ compiler output.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/96081] changed placement of file scope asm() contents
  2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
@ 2020-07-07  7:22 ` rguenth at gcc dot gnu.org
  2020-07-07  9:33 ` jbeulich at suse dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-07  7:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2020-07-07
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you provide a testcase?  Did you try -fno-toplevel-reorder?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/96081] changed placement of file scope asm() contents
  2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
  2020-07-07  7:22 ` [Bug inline-asm/96081] " rguenth at gcc dot gnu.org
@ 2020-07-07  9:33 ` jbeulich at suse dot com
  2020-07-07 10:58 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jbeulich at suse dot com @ 2020-07-07  9:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

--- Comment #2 from jbeulich at suse dot com ---
I wasn't even aware of -fno-toplevel-reorder, this suffices as a workaround
here. Thanks.

If nevertheless you're still interested in a testcase, please let me know; for
the moment I'll assume this is intended behavior, even if such a change seems
somewhat odd to make between minor version releases.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/96081] changed placement of file scope asm() contents
  2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
  2020-07-07  7:22 ` [Bug inline-asm/96081] " rguenth at gcc dot gnu.org
  2020-07-07  9:33 ` jbeulich at suse dot com
@ 2020-07-07 10:58 ` rguenther at suse dot de
  2020-07-07 13:52 ` jbeulich at suse dot com
  2020-07-07 14:08 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenther at suse dot de @ 2020-07-07 10:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 7 Jul 2020, jbeulich at suse dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081
> 
> --- Comment #2 from jbeulich at suse dot com ---
> I wasn't even aware of -fno-toplevel-reorder, this suffices as a workaround
> here. Thanks.
> 
> If nevertheless you're still interested in a testcase, please let me know; for
> the moment I'll assume this is intended behavior, even if such a change seems
> somewhat odd to make between minor version releases.

Yes, it's intended behavior and the order is not exactly random but it may
indeed appear so - there certainly wasn't an intention to change it.

You have to use -fno-toplevel-reorder if the order of asms, functions
and variables matter.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/96081] changed placement of file scope asm() contents
  2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
                   ` (2 preceding siblings ...)
  2020-07-07 10:58 ` rguenther at suse dot de
@ 2020-07-07 13:52 ` jbeulich at suse dot com
  2020-07-07 14:08 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jbeulich at suse dot com @ 2020-07-07 13:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

--- Comment #4 from jbeulich at suse dot com ---
Turns out I was wrong here, and the re-ordering was done even by older than gcc
9. The move from 9.2 to 9.3 also included a move to a newer gas, which made the
issue noticable.

Feel free to close as invalid. I'm sorry for the noise.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/96081] changed placement of file scope asm() contents
  2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
                   ` (3 preceding siblings ...)
  2020-07-07 13:52 ` jbeulich at suse dot com
@ 2020-07-07 14:08 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-07 14:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
No problem.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-07 14:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 15:45 [Bug inline-asm/96081] New: changed placement of file scope asm() contents jbeulich at suse dot com
2020-07-07  7:22 ` [Bug inline-asm/96081] " rguenth at gcc dot gnu.org
2020-07-07  9:33 ` jbeulich at suse dot com
2020-07-07 10:58 ` rguenther at suse dot de
2020-07-07 13:52 ` jbeulich at suse dot com
2020-07-07 14:08 ` rguenth at gcc dot gnu.org

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).