public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S
@ 2022-11-04 11:20 alex.fan.q at gmail dot com
  2022-11-04 11:23 ` [Bug libc/29749] " alex.fan.q at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: alex.fan.q at gmail dot com @ 2022-11-04 11:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

            Bug ID: 29749
           Summary: clarify usage of .cfi_label in riscv start.S
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: alex.fan.q at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

riscv's start.S includes a `.cfi_label dummy` directive in [1]. The comment
above it says 
> use a dummy .cfi_label to force starting the FDE.`
but as I understand it, `ENTRY (ENTRY_POINT)` macro includes a
`.cfi_startproc`, which should already do the same thing as comment suggests.

This directive was introduced in
https://sourceware.org/bugzilla/show_bug.cgi?id=23125 , but the original patch
in the first comment didn't include cfi_label and works as reported.

Zig compilation gets stuck on this directive as clang doesn't support it [2].

Can I get some help to clarify this directive and whether it is okay to remove
it?

[1]
https://github.com/bminor/glibc/blob/8c77e26ba8b360c851b2b9485bb4431aacc51ad1/sysdeps/riscv/start.S#L48
[2] https://github.com/ziglang/zig/issues/3340

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/29749] clarify usage of .cfi_label in riscv start.S
  2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
@ 2022-11-04 11:23 ` alex.fan.q at gmail dot com
  2022-11-04 11:31 ` alex.fan.q at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: alex.fan.q at gmail dot com @ 2022-11-04 11:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

--- Comment #1 from Alex Fan <alex.fan.q at gmail dot com> ---
btw, this issue originally opened at
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1149 and I was
suggested to report it here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/29749] clarify usage of .cfi_label in riscv start.S
  2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
  2022-11-04 11:23 ` [Bug libc/29749] " alex.fan.q at gmail dot com
@ 2022-11-04 11:31 ` alex.fan.q at gmail dot com
  2022-11-05  5:15 ` alex.fan.q at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: alex.fan.q at gmail dot com @ 2022-11-04 11:31 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

Alex Fan <alex.fan.q at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schwab@linux-m68k.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/29749] clarify usage of .cfi_label in riscv start.S
  2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
  2022-11-04 11:23 ` [Bug libc/29749] " alex.fan.q at gmail dot com
  2022-11-04 11:31 ` alex.fan.q at gmail dot com
@ 2022-11-05  5:15 ` alex.fan.q at gmail dot com
  2022-11-08 15:38 ` schwab@linux-m68k.org
  2022-11-11 13:16 ` alex.fan.q at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: alex.fan.q at gmail dot com @ 2022-11-05  5:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

Alex Fan <alex.fan.q at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph at codesourcery dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/29749] clarify usage of .cfi_label in riscv start.S
  2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
                   ` (2 preceding siblings ...)
  2022-11-05  5:15 ` alex.fan.q at gmail dot com
@ 2022-11-08 15:38 ` schwab@linux-m68k.org
  2022-11-11 13:16 ` alex.fan.q at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2022-11-08 15:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
.cfi_startproc does *not* start the FDE.  Without .cfi_label, the
DW_CFA_undefined directive is part of the CIE.

$ readelf -wf csu/start.o
Contents of the .eh_frame section:


00000000 0000000000000014 00000000 CIE
  Version:               3
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 1
  Augmentation data:     1b
  DW_CFA_def_cfa_register: r2 (sp)
  DW_CFA_undefined: r1 (ra)
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000018 0000000000000014 0000001c FDE cie=00000000
pc=0000000000000002..000000000000002c
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/29749] clarify usage of .cfi_label in riscv start.S
  2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
                   ` (3 preceding siblings ...)
  2022-11-08 15:38 ` schwab@linux-m68k.org
@ 2022-11-11 13:16 ` alex.fan.q at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: alex.fan.q at gmail dot com @ 2022-11-11 13:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29749

--- Comment #3 from Alex Fan <alex.fan.q at gmail dot com> ---
(In reply to Andreas Schwab from comment #2)
> .cfi_startproc does *not* start the FDE.  Without .cfi_label, the
> DW_CFA_undefined directive is part of the CIE.

I find llvm assembler puts it into fde without needing .cfi_label. Is
cfi_startproc meant to mark start of a function frame and fde is per function?

rv64d-dev0 /tmp # llvm-mc --filetype=obj -o=test.o test.s 
rv64d-dev0 /tmp # objdump --dwarf test.o

test.o:     file format elf64-littleriscv

Contents of the .eh_frame section:


00000000 0000000000000010 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 1
  Augmentation data:     1b
  DW_CFA_def_cfa: r2 (sp) ofs 0

00000014 0000000000000010 00000018 FDE cie=00000000
pc=000000000000001c..0000000000000020
  DW_CFA_undefined: r1 (ra)
  DW_CFA_nop

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2022-11-11 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 11:20 [Bug libc/29749] New: clarify usage of .cfi_label in riscv start.S alex.fan.q at gmail dot com
2022-11-04 11:23 ` [Bug libc/29749] " alex.fan.q at gmail dot com
2022-11-04 11:31 ` alex.fan.q at gmail dot com
2022-11-05  5:15 ` alex.fan.q at gmail dot com
2022-11-08 15:38 ` schwab@linux-m68k.org
2022-11-11 13:16 ` alex.fan.q at gmail 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).