public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107251] New: RISC-V linux kernel compiled with -mno-relax generates a lot of local symbols
@ 2022-10-13 15:44 xnox at ubuntu dot com
  0 siblings, 0 replies; only message in thread
From: xnox at ubuntu dot com @ 2022-10-13 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107251
           Summary: RISC-V linux kernel compiled with -mno-relax generates
                    a lot of local symbols
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xnox at ubuntu dot com
  Target Milestone: ---

Previous reported at
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1036

$ du -h btrfs.ko.*
76M     btrfs.ko.riscv64
42M     btrfs.ko.x86_64

$ strip --strip-debug btrfs.ko.x86_64
$ riscv64-linux-gnu-strip --strip-debug btrfs.ko.riscv64 

$ du -h btrfs.ko.*
17M     btrfs.ko.riscv64
2.8M    btrfs.ko.x86_64

$ strip --strip-debug --discard-locals btrfs.ko.x86_64
$ riscv64-linux-gnu-strip --strip-debug --discard-locals btrfs.ko.riscv64

$ du -h btrfs.ko.*
4.2M    btrfs.ko.riscv64
2.8M    btrfs.ko.x86_64

The above demonstrates that RISCV kernel modules are compiled with -mno-relax
option, and yet a lot of relocation symbols are emitted and remain in the
modules keeping their size very large.

Over on github issue it was mentioned that "There is a known problem with GNU
as that we still emit extra symbols and relocations when -mno-relax is used.
Kernel modules are compiled -mno-relax. So fixing this would help reduce the
symtab size." However I was unable to find a bug report pointing this out.

Could you please ensure that when compiling code, the extra symbols and
relocations are not emitted, or otherwise stripped? Such that calling
--discard-locals would have no particular effect on the binary sizes. It is
inconvenient for distributions to call --discard-locals on riscv, even when
otherwise one is keeping the rest of the debug symbols for example.

I have observed this with gcc-10 and upwords, and most recently with gcc-12. I
can try newer builds of gcc and/or any patches to confirm behaviour.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-13 15:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 15:44 [Bug c/107251] New: RISC-V linux kernel compiled with -mno-relax generates a lot of local symbols xnox at ubuntu 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).