public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99217] New: [MIPS] wrong function entry with -fpatchable-function-entry
@ 2021-02-23 11:37 huangpei at loongson dot cn
  2021-02-23 19:44 ` [Bug target/99217] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: huangpei at loongson dot cn @ 2021-02-23 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99217
           Summary: [MIPS] wrong function entry with
                    -fpatchable-function-entry
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: huangpei at loongson dot cn
  Target Milestone: ---

On Debian AMD64 unstable,
-----------------
depaulose@localhost:~$ cat a.c
void f() {}
depaulose@localhost:~$ gcc -fpatchable-function-entry=3  -c a.c

depaulose@localhost:~$ objdump -d a.o

a.o:     file format elf64-tradlittlemips


Disassembly of section .text:

0000000000000000 <f-0xc>:
        ...

000000000000000c <f>:
   c:   67bdfff0        daddiu  sp,sp,-16
  10:   ffbe0008        sd      s8,8(sp)
  14:   03a0f025        move    s8,sp
  18:   00000000        nop
  1c:   03c0e825        move    sp,s8
  20:   dfbe0008        ld      s8,8(sp)
  24:   67bd0010        daddiu  sp,sp,16
  28:   03e00008        jr      ra
  2c:   00000000        nop
depaulose@localhost:~$ readelf -s a.o

Symbol table '.symtab' contains 14 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS a.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    2
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    8
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    9
     7: 0000000000000000     0 SECTION LOCAL  DEFAULT   12
     8: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
     9: 0000000000000000     0 SECTION LOCAL  DEFAULT    5
    10: 0000000000000000     0 SECTION LOCAL  DEFAULT    6
    11: 0000000000000000     0 SECTION LOCAL  DEFAULT   11
    12: 0000000000000000     0 SECTION LOCAL  DEFAULT   13
    13: 000000000000000c    36 FUNC    GLOBAL DEFAULT    1 f
depaulose@localhost:~$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

depaulose@localhost:~$ as --version
GNU assembler (GNU Binutils for Debian) 2.35.2
Copyright (C) 2020 Free Software Foundation, Inc.
This assembler was configured for a target of `mips64el-linux-gnuabi64'.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `mips64el-linux-gnuabi64'.

------------------


It turned out that function address is wrong. It is expected that the function
entry is 0 not 0xc

On Debian 10 , for arm64, same file

--------------------------

ambrosehua@ambrosehua-HP-xw6600-Workstation:Downloads$ aarch64-linux-gnu-gcc-8
-fpatchable-function-entry=3 -c a.c
ambrosehua@ambrosehua-HP-xw6600-Workstation:Downloads$
aarch64-linux-gnu-objdump -d a.o

a.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <f>:
   0:   d503201f        nop
   4:   d503201f        nop
   8:   d503201f        nop
   c:   d503201f        nop
  10:   d65f03c0        ret
ambrosehua@ambrosehua-HP-xw6600-Workstation:Downloads$ readelf -s a.o

Symbol table '.symtab' contains 12 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS a.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    2
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
     5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    1 $x
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
     7: 0000000000000000     0 SECTION LOCAL  DEFAULT    7
     8: 0000000000000014     0 NOTYPE  LOCAL  DEFAULT    8 $d
     9: 0000000000000000     0 SECTION LOCAL  DEFAULT    8
    10: 0000000000000000     0 SECTION LOCAL  DEFAULT    6
    11: 0000000000000000    20 FUNC    GLOBAL DEFAULT    1 f
----------------------

here function address of f  is right

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

end of thread, other threads:[~2021-12-15 10:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 11:37 [Bug c/99217] New: [MIPS] wrong function entry with -fpatchable-function-entry huangpei at loongson dot cn
2021-02-23 19:44 ` [Bug target/99217] " pinskia at gcc dot gnu.org
2021-03-04  2:07 ` huangpei at loongson dot cn
2021-03-04  3:20 ` pinskia at gcc dot gnu.org
2021-03-05  7:22 ` huangpei at loongson dot cn
2021-12-04  7:54 ` huangpei at loongson dot cn
2021-12-15 10:00 ` huangpei at loongson dot cn
2021-12-15 10:01 ` huangpei at loongson dot cn

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