[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.3 |8.4

--- Comment #6 from Jakub Jelinek  ---
GCC 8.3 has been released.

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-02-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|jakub at gcc dot gnu.org   |unassigned at gcc dot 
gnu.org

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-02-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

--- Comment #5 from Jakub Jelinek  ---
Other option is to spend a lot of energy on this.  output_indirect_thunk would
need to be told if it is emitted inside of normal functions or in the magic
functions where it currently does the right thing already, for the normal
functions walk back from current_output_insn (perhaps with some caching) to
find out the previous NOTE_INSN_CFI that was already emitted, find
corresponding entry in cfun->dw_fde_cfi vector, interpret the CFI instructions
from the beginning until that point to figure out if the current CFA is stack
pointer or something else and only if it is stack pointer, add the cfi stuff in
there and undo it later.  Furthermore, I see e.g.
ix86_output_indirect_branch_via_push is emitting push instructions, that is
again a big no no unless you adjust unwind info too.

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-02-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

--- Comment #4 from Jakub Jelinek  ---
(In reply to Florian Weimer from comment #3)
> Isn't -fasynchronous-unwind-tables part of the GNU/Linux ABI and enabled by
> default?  Without it, asynchronous cancellation does not work.

Yes, but nobody is actually using or should use -mindirect-branch=thunk-inline,
we really shouldn't offer that option, and if somebody for some strange reason
uses it, he could as well add -fno-asynchronous-unwind-tables.

> Can we simplify this if we require frame pointers when using inline thunks? 

No.

> Or get rid of inline thunks altogether?

I'm all for this.  I fail to see any advantage of that over non-inline thunks,
that do have proper unwind info and are smaller from cache POV.

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-02-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-01-31 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Florian Weimer  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #3 from Florian Weimer  ---
Isn't -fasynchronous-unwind-tables part of the GNU/Linux ABI and enabled by
default?  Without it, asynchronous cancellation does not work.

Can we simplify this if we require frame pointers when using inline thunks?  Or
get rid of inline thunks altogether?

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-01-31 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Jakub Jelinek  changed:

   What|Removed |Added

 CC||fw at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
So, perhaps easiest is to revert the PR87414 changes and just error out on
-fasynchronous-unwind-tables with -mindirect-branch=thunk-inline.

The following testcase shows various cases:
void foo (char *);

int
f1 (int (*f) (void))
{
  return f ();
}

int
f2 (int (*f) (void))
{
  foo (0);
  return f ();
}

int
f3 (int (*f) (void))
{
  foo (0);
  return f () + 1;
}

int
f4 (int (*f) (void), int x)
{
  char buf[x];
  foo (buf);
  return f () + 1;
}

__attribute__((optimize ("no-omit-frame-pointer"))) int
f5 (int (*f) (void))
{
  foo (0);
  return f ();
}

The unwind info is incorrect in f3 (the CFA is already %rsp+16 before the call,
so for the mov + ret instruction we need %rsp+24 and then revert), f4 (CFA is
%rbp, so we shouldn't change CFA offset at all).
So, we'd need to figure out if CFA is sp or bp at the instruction (is it call
always?) for which we emit the thunk and only if it is sp, increase offset by
word size and decrease afterwards.
Furthermore, for -fno-dwarf2-cfi-asm, we likely need to search the CFI
instruction array and find where exactly to insert the new CFI, rather than
appending it.  What a mess!

[Bug target/88917] [8/9 Regression] Error: can't resolve `.text' {.text section} - `.LCFI2' {.text.unlikely section} with -fno-dwarf2-cfi-asm

2019-01-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88917

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-01-18
 CC||jakub at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
   Target Milestone|--- |8.3
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Started with my r264651.  Will have a look.