bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/27109] New: gas: Omit unused STT_SECTION symbols


From: i at maskray dot me
Subject: [Bug gas/27109] New: gas: Omit unused STT_SECTION symbols
Date: Wed, 23 Dec 2020 23:48:04 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27109

            Bug ID: 27109
           Summary: gas: Omit unused STT_SECTION symbols
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

% cat a.s
call .text.0

.section .text.0,"ax",@progbits
.section .text.1,"ax",@progbits
% as a.s -o a.o
% llvm-mc -filetype=obj a.s -o b.o
% readelf -Ws a.o

Symbol table '.symtab' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    6
% readelf -Ws b.o

Symbol table '.symtab' contains 2 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
(The only STT_SECTION symbol is for .text.0, which is referenced by a
relocation.)

LLVM integrated assembler omits unused STT_SECTION symbols.
This behavior was introduced in 2015 (https://reviews.llvm.org/rL239045)
and is a very efficient size optimization, especially for -ffunction-sections
-fdata-sections.

This is quite significant on ELF64 because on ELF64 an unused STT_SECTION costs
sizeof(Elf64_Shdr)=64 bytes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]