[Bug ld/31409] ld arm: global/weak non-hidden symbols referenced by R_ARM_FUNCDESC are unnecessarily exported

2024-02-23 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31409

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

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


[Bug ld/31409] ld arm: global/weak non-hidden symbols referenced by R_ARM_FUNCDESC are unnecessarily exported

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31409

--- Comment #1 from Fangrui Song  ---
bfd/elf32-arm.c:16521

  if (eh->fdpic_cnts.funcdesc_cnt > 0)
{
  if (htab->root.dynamic_sections_created && h->dynindx == -1
  && !h->forced_local)
if (! bfd_elf_link_record_dynamic_symbol (info, h))
  return false;

is too conservative. bfd_elf_link_record_dynamic_symbol records some symbols
that do not need to be exported.

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


[Bug ld/31409] ld arm: global/weak non-hidden symbols referenced by R_ARM_FUNCDESC are unnecessarily exported

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31409

Fangrui Song  changed:

   What|Removed |Added

 CC||clyon at gcc dot gnu.org

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


[Bug ld/31409] New: ld arm: global/weak non-hidden symbols referenced by R_ARM_FUNCDESC are unnecessarily exported

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31409

Bug ID: 31409
   Summary: ld arm: global/weak non-hidden symbols referenced by
R_ARM_FUNCDESC are unnecessarily exported
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

% cat a.s
.globl _start, f0, f1
.weak f2
.protected f1
_start: f0: f1: f2: fl: bx lr

.data
.long f0(FUNCDESC)
.long f1(FUNCDESC)
.long f2(FUNCDESC)
.long fl(FUNCDESC)

% ./bin/as-new --fdpic a.s -o a.o && ./bin/ld-new -m armelf_linux_fdpiceabi a.o
-pie -z noexecstack -o a
% readelf --dyn-syms a

Symbol table '.dynsym' contains 9 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1: 00f4 0 SECTION LOCAL  DEFAULT1 .interp
 2: 0204 0 SECTION LOCAL  DEFAULT6 .text
 3: 0208 0 SECTION LOCAL  DEFAULT7 .rofixup
 4: 128c 0 SECTION LOCAL  DEFAULT9 .got
 5: 12a0 0 SECTION LOCAL  DEFAULT   10 .data
 6: 0204 0 NOTYPE  WEAK   DEFAULT6 f2
 7: 0204 0 NOTYPE  GLOBAL DEFAULT6 f0
 8: 0204 0 NOTYPE  GLOBAL PROTECTED6 f1

In a non-FDPIC link when f0/f1/f2 are referenced by absolute relocations, 
f0/f1/f2 are not exported
(https://maskray.me/blog/2020-11-15-explain-gnu-linker-options#export-dynamic
describes the symbol export rule).

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


[Bug ld/31408] New: ld arm: fdpic link segfaults on R_ARM_GOTOFFFUNCDESC referencing a hidden symbol

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31408

Bug ID: 31408
   Summary: ld arm: fdpic link segfaults on R_ARM_GOTOFFFUNCDESC
referencing a hidden symbol
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

% cat a.c
__attribute__((visibility("hidden"))) void fun_hidden();
void *fun_hidden_addr() { return fun_hidden; }
% ./bin/ld-new -m armelf_linux_fdpiceabi a.o
[1]3819239 segmentation fault  ./bin/ld-new a.o
% ./bin/ld-new -m armelf_linux_fdpiceabi -shared a.o
./bin/ld-new: BFD (GNU Binutils) 2.42.50.20240224 internal error, aborting at
../../../bfd/elf32-arm.c:16466 in allocate_dynrelocs_for_symbol

./bin/ld-new: Please report this bug.


If fun_hidden is defined, -shared will suceed while -no-pie still segfaults.

(gdb) bt
#0  allocate_dynrelocs_for_symbol (h=0x557d5430, inf=0x557acf80
) at ../../../bfd/elf32-arm.c:16474
#1  0x556e6892 in bfd_link_hash_traverse
(htab=htab@entry=0x557d4950, func=func@entry=0x556f8ba0
, info=info@entry=0x557acf80 ) at
../../../bfd/linker.c:674
#2  0x5570dc8b in elf_link_hash_traverse (info=0x557acf80
, f=0x556f8ba0 ,
table=0x557d4950) at ../../../bfd/elf-bfd.h:787
#3  elf32_arm_size_dynamic_sections (output_bfd=0x557d2830,
info=0x557acf80 ) at ../../../bfd/elf32-arm.c:16986
#4  0x55738ba9 in bfd_elf_size_dynamic_sections (output_bfd=, soname=, rpath=rpath@entry=0x0, filter_shlib=0x0,
audit=audit@entry=0x0, depaudit=0x0, auxiliary_filters=0x0, info=0x557acf80
,
sinterpptr=0x7fffd388) at ../../../bfd/elflink.c:7488
#5  0x556d803b in ldelf_before_allocation (audit=,
depaudit=, default_interpreter_name=0x0) at
../../../ld/ldelf.c:1839
#6  0x556bfb9b in lang_process () at ../../../ld/ldlang.c:8423
#7  0x556c4680 in main (argc=, argv=) at
../../../ld/ldmain.c:504



16468│   /* We only allocate one function descriptor with its associated
16469│  relocation.  */
16470│   if (eh->fdpic_cnts.funcdesc_offset == -1)
16471│ {
16472│   asection *s = htab->root.sgot; / s is null
16473│
16474│   eh->fdpic_cnts.funcdesc_offset = s->size;
16475│   s->size += 8;


PR31407 is a similar bug failing on another line in
allocate_dynrelocs_for_symbol

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


[Bug ld/31408] ld arm: fdpic link segfaults on R_ARM_GOTOFFFUNCDESC referencing a hidden symbol

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31408

Fangrui Song  changed:

   What|Removed |Added

 CC||clyon at gcc dot gnu.org
 Target||arm*-*-uclinuxfdpiceabi

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


[Bug gas/25333] GAS is slow processing units compiled with -fdebug-types-sections containing many types

2024-02-23 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25333

Alan Modra  changed:

   What|Removed |Added

   Target Milestone|--- |2.43
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Alan Modra  ---
Fixed.

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


[Bug gas/25333] GAS is slow processing units compiled with -fdebug-types-sections containing many types

2024-02-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25333

--- Comment #4 from Sourceware Commits  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=086c8f406d82ce171d5867eed93f1308e07252c5

commit 086c8f406d82ce171d5867eed93f1308e07252c5
Author: Alan Modra 
Date:   Sat Feb 24 11:38:57 2024 +1030

PR25333, GAS is slow processing -fdebug-types-sections

gas needs to build lists of sections for each group.  This arranges to
build the lists earlier, so they can be used when looking for sections
that belong to a group.  Using the section hash table to find sections
by name, then by group isn't efficient when there are numerous groups
with the same section names.  Using a hash table to quickly find a
group, then searching by section name on a list for the group results
in a 100-fold speed improvement assembling the testcase in this PR.

To reduce the number of times we traverse the section list, the patch
also moves some processing done in elf_adjust_symtab for linked-to
section, to elf_frob_file.  This requires a testsuite change because
processing will stop before elf_frob_file if there is a parse error in
section21.s, ie. you'll only get the "junk at end of line" error, not
the "undefined linked-to symbol" errors.

PR 25333
* config/obj-elf.c (struct group_list, groups): Move earlier.
(match_section): New function, extracted from..
(get_section_by_match): ..here.
(free_section_idx): Move earlier.
(group_section_find, group_section_insert): New functions.
(change_section): Use the above.
(elf_set_group_name): New function.
(obj_elf_attach_to_group): Use elf_set_group_name.
(set_additional_section_info): Handle linked_to_symbol_name and
stabs code, extracted from..
(adjust_stab_sections): ..here,..
(build_additional_section_info): ..and here.
(elf_adjust_symtab): Don't call build_additional_section_info.
(elf_frob_file): Adjust.
* config/obj-elf.h (elf_set_group_name): Declare.
* config/tc-xtensa.c (cache_literal_section): Use
elf_set_group_name.
(xtensa_make_property_section): Likewise.
* testsuite/gas/elf/attach-1.d: Stricter group section matching,
and changed group section ordering.
* testsuite/gas/elf/attach-2.d: Stricter group section matching.
* testsuite/gas/elf/attach-2.s: Provide section bar type.
* testsuite/gas/elf/elf.exp: Run attach-2.
* testsuite/gas/elf/section21.l: Update.
* testsuite/gas/elf/section21.s: Don't check for a parse error.

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


[Bug gas/25333] GAS is slow processing units compiled with -fdebug-types-sections containing many types

2024-02-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25333

--- Comment #3 from Sourceware Commits  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc45bfd25984a709dec4236daf412c58a127633a

commit bc45bfd25984a709dec4236daf412c58a127633a
Author: Alan Modra 
Date:   Sat Feb 24 11:30:02 2024 +1030

xtensa: move xtensa_make_property_section from bfd to gas

This function is only used by gas, so move it there.  Necessary for
gas to keep track of group sections as they are created.

PR 25333
bfd/
* elf32-xtensa.c (xtensa_make_property_section): Delete.
(xtensa_property_section_name): Make public.
include/
* elf/xtensa.h (xtensa_make_property_section): Delete.
(xtensa_property_section_name): Declare
gas/
* config/tc-xtensa.c (xtensa_make_property_section): New,
moved from elf32-xtensa.c.

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


[Bug ld/31407] ld arm: fdpic link may have null pointer dereference in allocate_dynrelocs_for_symbol

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31407

Fangrui Song  changed:

   What|Removed |Added

 Target||arm*-*-uclinuxfdpiceabi
 CC||clyon at gcc dot gnu.org

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


[Bug ld/31407] New: ld arm: fdpic link may have null pointer dereference in allocate_dynrelocs_for_symbol

2024-02-23 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=31407

Bug ID: 31407
   Summary: ld arm: fdpic link may have null pointer dereference
in allocate_dynrelocs_for_symbol
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

Noticed while investigating the behavior of .rofixup

% cat a.s
.globl foo
foo:
  bx lr

.data
.long foo

% ./bin/as-new --fdpic a.s -o a.o && ./bin/ld-new -m armelf_linux_fdpiceabi a.o
-o a
./bin/ld-new: warning: a.o: missing .note.GNU-stack section implies executable
stack
./bin/ld-new: NOTE: This behaviour is deprecated and will be removed in a
future version of the linker
[1]3777145 segmentation fault  ./bin/ld-new -m armelf_linux_fdpiceabi a.o
-o a


(gdb) bt
#0  0x556f9220 in allocate_dynrelocs_for_symbol (h=0x557d5348,
inf=0x557acf80 ) at ../../../bfd/elf32-arm.c:16704
#1  0x556e6892 in bfd_link_hash_traverse
(htab=htab@entry=0x557d4950, func=func@entry=0x556f8ba0
, info=info@entry=0x557acf80 ) at
../../../bfd/linker.c:674
#2  0x5570dc8b in elf_link_hash_traverse (info=0x557acf80
, f=0x556f8ba0 ,
table=0x557d4950) at ../../../bfd/elf-bfd.h:787
#3  elf32_arm_size_dynamic_sections (output_bfd=0x557d2830,
info=0x557acf80 ) at ../../../bfd/elf32-arm.c:16986
#4  0x55738ba9 in bfd_elf_size_dynamic_sections (output_bfd=, soname=, rpath=rpath@entry=0x0, filter_shlib=0x0,
audit=audit@entry=0x0, depaudit=0x0, auxiliary_filters=0x0, info=0x557acf80
, sinterpptr=0x7fffd3
68) at ../../../bfd/elflink.c:7488
#5  0x556d803b in ldelf_before_allocation (audit=,
depaudit=, default_interpreter_name=0x0) at
../../../ld/ldelf.c:1839
#6  0x556bfb9b in lang_process () at ../../../ld/ldlang.c:8423
#7  0x556c4680 in main (argc=, argv=) at
../../../ld/ldmain.c:504

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


[Bug gas/25333] GAS is slow processing units compiled with -fdebug-types-sections containing many types

2024-02-23 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25333

Alan Modra  changed:

   What|Removed |Added

 CC|amodra at gmail dot com|
 Status|NEW |ASSIGNED
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

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


[Bug gas/31388] There is no documentation for -moperand-check

2024-02-23 Thread jbeulich at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31388

Jan Beulich  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Jan Beulich  ---
And thus taken care of.

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


[Bug gas/31388] There is no documentation for -moperand-check

2024-02-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31388

--- Comment #1 from Sourceware Commits  ---
The master branch has been updated by Jan Beulich :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=db5aae3ccd7af607e1a3af1df9f3bdb62d7e5259

commit db5aae3ccd7af607e1a3af1df9f3bdb62d7e5259
Author: Jan Beulich 
Date:   Fri Feb 23 11:59:42 2024 +0100

x86: document -moperand-check=

PR gas/31388
Like other command line options this should be mentioned in
documentation as well, not just in "as --help" output.

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


[Bug gprofng/31390] [display html] Undefined subroutine ::hex

2024-02-23 Thread ruud.vanderpas at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31390

--- Comment #5 from Ruud van der Pas  ---
Thanks for the update! Great to hear that this works for you now.

I plan to work on a patch to eliminate the reliance on bignum and use bigint
instead.

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