public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "huangpei at loongson dot cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99217] New: [MIPS] wrong function entry with -fpatchable-function-entry Date: Tue, 23 Feb 2021 11:37:18 +0000 [thread overview] Message-ID: <bug-99217-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2021-02-23 11:37 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-23 11:37 huangpei at loongson dot cn [this message] 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
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 * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99217-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).