From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D44EC3858C55; Thu, 13 Oct 2022 15:44:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D44EC3858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665675895; bh=RvYpIbf24tJhUWW1u72/d4t/PStT5Uqs/ScDwSNVoDc=; h=From:To:Subject:Date:From; b=h4SSewXcoGDh3WFBBq9v8jnKipKejkEZMj7pVFHGGGgrV03MZKce+1UBsPNNkUokw xJqerRf+We1gWB3bV8sZk5qZSTF4QVwP7TCxhhyEWg+MiByGcYQA2m4/MDerF0sATb xJ09u1+rbgOP8JpL12YzxN+G7jRMZOC9Tb3BsarM= From: "xnox at ubuntu dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107251] New: RISC-V linux kernel compiled with -mno-relax generates a lot of local symbols Date: Thu, 13 Oct 2022 15:44:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xnox at ubuntu dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107251 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=20 $ 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-rel= ax 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 G= NU 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.=