From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A249D386F02B; Tue, 12 May 2020 21:57:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A249D386F02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589320671; bh=wF7fSEVoNI50IVWYX40LSA8skW1zmPNzqRM3Z9eEqxI=; h=From:To:Subject:Date:From; b=Wu0bBZ+JEBZ/RKK2kkNZtk4Qt59WgtnfAL78G7IRN/bmPHO7PMIjIyJfovmS7ErQn uttjjA/gCBi9faL9L4TZMjH2jLz5gznoSq7NHL6T7IjOmY5r74zUpcrzCpVHHxr97q FyVlEaiFOBYb3oaAT5fOLO3TGUTWOcHK2iwDUbTY= From: "i at maskray dot me" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95095] New: Feature request: support -fno-unique-section-names Date: Tue, 12 May 2020 21:57:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: i at maskray dot me 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 21:57:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95095 Bug ID: 95095 Summary: Feature request: support -fno-unique-section-names Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: i at maskray dot me Target Milestone: --- -ffunction-sections produces sections .text.foo , .text.bar , etc, which can take significant amount of string table space. In clang, -fno-unique-section-names emits multiple ".text" sections which c= an share the section name. Multiple sections with the same name require the new GNU as feature https://sourceware.org/bugzilla/show_bug.cgi?id=3D25380 (bin= utils 2.35). For .text.exit.* .text.unlikely.* .text.hot.* .text.startup.* , the preferr= ed sections are .text.exit. .text.unlikely. .text.hot. .text.startup. The trai= ling dots can avoid a linker problem described in https://reviews.llvm.org/D79600 --------- pasted below for your convenience GNU ld's internal linker script uses (https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dadd44f8d5c= 5c05e08b11e033127a744d61c26aee) .text : { *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) *(.text.startup .text.startup.*) *(.text.hot .text.hot.*) *(SORT(.text.sorted.*)) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf.em. */ *(.gnu.warning) } Because *(.text.exit .text.exit.*) is ordered before *(.text .text.*), in a -ffunction-sections build, the C library function exit will be placed before other functions. gold's -z keep-text-section-prefix has the same problem. In lld, -z keep-text-section-prefix recognizes .text.{exit,hot,startup,unlikely,unknown}.*, but not .text.{exit,hot,startup,unlikely,unknown}, to avoid the strange placement problem.=