bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/27931] New: objcopy --localize-hidden/--keep-global-symbol


From: i at maskray dot me
Subject: [Bug binutils/27931] New: objcopy --localize-hidden/--keep-global-symbol: drop GRP_COMDAT if the signature symbol becomes local?
Date: Sat, 29 May 2021 23:54:11 +0000

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

            Bug ID: 27931
           Summary: objcopy --localize-hidden/--keep-global-symbol: drop
                    GRP_COMDAT if the signature symbol becomes local?
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

cat > ./a.s <<eof
.section        .text._Z3foov,"axG",@progbits,_Z3foov,comdat
.hidden _Z3foov
.weak   _Z3foov
.type   _Z3foov,@function
_Z3foov:
  ret
eof
cc -c a.s

GRP_COMDAT deduplication is based on name, so after objcopy --localize-hidden,
the group may keep deduplication semantics. This may be undesired if the user
intention is to make the hidden symbols fully internal.

% objcopy --localize-hidden a.o b.o && readelf -Ws -x .group b.o

Symbol table '.symtab' contains 8 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FUNC    LOCAL  HIDDEN     5 _Z3foov
     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    4 
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
     7: 0000000000000000     0 SECTION LOCAL  DEFAULT    6 

Hex dump of section '.group':
  0x00000000 01000000 05000000                   ........


-G is similar.

See https://groups.google.com/g/generic-abi/c/2X6mR-s2zoc "GRP_COMDAT group
with STB_LOCAL signature" for a generic-abi discussion.

-- 
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]