[Bug gas/30279] UBSAN error: /buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20

2023-03-27 Thread pinskia at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=30279

Andrew Pinski  changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|MOVED   |---
 CC||pinskia at gcc dot gnu.org
 Ever confirmed|1   |0

--- Comment #3 from Andrew Pinski  ---
The code in gas/config/tc-m68hc11.c is undefined:
  opc = XNEWVEC (struct m68hc11_opcode_def, num_opcodes);
  m68hc11_opcode_defs = opc--;


This is not defined at all. You cannot take the address before the start of the
allocated area.

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


[Bug gprofng/30281] New: error: multiple definition of `pwrite@GLIBC_2.2'; on i586-linux-gnu

2023-03-27 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

Bug ID: 30281
   Summary: error: multiple definition of `pwrite at GLIBC_2 dot 2'; on
i586-linux-gnu
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: gprofng
  Assignee: vladimir.mezentsev at oracle dot com
  Reporter: mliska at suse dot cz
  Target Milestone: ---

The following happens if I build binutils on i586, likely since
66f76c545b293f8b89fef0f996a3a48fa59fae61:

[   35s] + ../configure 'CFLAGS=-fomit-frame-pointer -O2 -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type 
-Wno-error' 'CXXFLAGS=-fomit-frame-pointer -O2 -Wall -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type 
-Wno-error' --prefix=/usr --libdir=/usr/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-bugurl=https://bugs.opensuse.org/
'--with-pkgversion=GNU Binutils; devel:gcc:next / openSUSE_Tumbleweed'
--with-separate-debug-dir=/usr/lib/debug --with-pic --with-system-zlib
--build=i586-suse-linux
--enable-targets=aarch64-suse-linux,alpha-suse-linux,armv5l-suse-linux,armv6l-suse-linux,armv7l-suse-linux,armv8l-suse-linux,avr-suse-linux,pru-suse-linux,epiphany-suse-linux,hppa-suse-linux,hppa64-suse-linux,i686-suse-linux,ia64-suse-linux,m68k-suse-linux,mips-suse-linux,powerpc-suse-linux,powerpc64-suse-linux,powerpc64le-suse-linux,riscv64-suse-linux,rx-suse-linux,s390-suse-linux,s390x-suse-linux,sh4-suse-linux,sparc-suse-linux,sparc64-suse-linux,x86_64-suse-linux,xtensa-suse-linux,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep,bpf-none
--enable-plugins --enable-gold --enable-threads
--enable-compressed-debug-sections=gas --enable-new-dtags
--enable-default-hash-style=both --enable-shared --enable-pgo-build=lto
--enable-colored-disassembly --enable-obsolete --enable-warn-execstack=yes
--enable-warn-rwx-segments=yes
...
[  652s] libtool: link: gcc -shared  -fPIC -DPIC  .libs/iotrace.o   
-fprofile-generate -Wl,--version-script
-Wl,../../../gprofng/libcollector/libgprofng.ver -Wl,--no-as-needed -Wl,-lrt
-Wl,-ldl   -Wl,-soname -Wl,libgp-iotrace.so -o .libs/libgp-iotrace.so
[  652s] /usr/lib/gcc/i586-suse-linux/13/../../../../i586-suse-linux/bin/ld:
/tmp/ccAGQBAo.ltrans1.ltrans.o: in function `pwrite':
[  652s] :(.text+0x0): multiple definition of `pwrite@GLIBC_2.2';
/tmp/ccAGQBAo.ltrans0.ltrans.o::(.text+0xc620): first defined here
[  652s] collect2: error: ld returned 1 exit status
[  652s] make[5]: *** [Makefile:576: libgp-iotrace.la] Error 1
[  652s] make[5]: Leaving directory
'/home/abuild/rpmbuild/BUILD/binutils-2.40.50/build-dir/gprofng/libcollector'
[  652s] make[4]: *** [Makefile:478: all] Error 2
[  652s] make[3]: *** [Makefile:472: all-recursive] Error 1
[  652s] make[2]: *** [Makefile:404: all] Error 2
[  652s] make[1]: *** [Makefile:7781: all-gprofng] Error 2
[  652s] make[1]: *** Waiting for unfinished jobs

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


[Bug gas/30279] UBSAN error: /buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20

2023-03-27 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=30279

Martin Liska  changed:

   What|Removed |Added

 Resolution|INVALID |MOVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=109308

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


[Bug gas/30279] UBSAN error: /buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20

2023-03-27 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=30279

Martin Liska  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Martin Liska  ---
You are right, it's something new that started with r13-222-g28896b38fabce8,
let me reduce a test-case.

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


[Bug gas/30279] UBSAN error: /buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20

2023-03-27 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30279

--- Comment #1 from Alan Modra  ---
Compiler bug?  I don't reproduce the error here, and can't see any problem in
the code at the reported line.

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


[Bug gprofng/30089] [display text] Incorrect thread count shown on aarch64

2023-03-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=30089

--- Comment #1 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Vladimir Mezentsev
:

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

commit 66f76c545b293f8b89fef0f996a3a48fa59fae61
Author: Vladimir Mezentsev 
Date:   Thu Mar 23 11:46:08 2023 -0700

gprofng: 30089 [display text] Invalid number of threads

The real problem is that libcollector doesn't interpose
thread_create@GLIBC_2.34
We interpose a lot of libC functions (dlopen, fork, pthread_create, etc.).
Some of these functions have versions. For example, dlopen@GLIBC_2.34,
dlopen@GLIBC_2.17, dlopen@GLIBC_2.2.5, etc.
We have to interpose each of the functions because we don't know
which version of libC will be used during profiling.
Historically, we have used three versions of scripts
(mapfile.aarch64-Linux,
mapfile.amd64-Linux, mapfile.intel-Linux).
Three are not needed. One is enough

The fixes below include:
 - merged all version symbols into one version script.
 - added new version symbols which are defined in latest versions of libC.
 - removed unused defines and duplicated code.
 - added the DCL_FUNC_VER macro to define the version symbols.

Tested on x86_64 and aarch64 (OL8/OL9). No regression.

gprofng/ChangeLog
2023-03-23  Vladimir Mezentsev  

PR gprofng/30089
* libcollector/Makefile.am: Use libgprofng.ver instead of mapfile.*
* libcollector/configure.ac: Delete GPROFNG_VARIANT.
* src/collector_module.h: Move the SYMVER_ATTRIBUTE macro to
collector.h
* libcollector/collector.h: Add macros (SYMVER_ATTRIBUTE,
DCL_FUNC_VER).
Remove unused defines.
* libcollector/dispatcher.c: Interpose functions from libC.
Clean up the old code.
* libcollector/iotrace.c: Likewise.
* libcollector/libcol_util.c: Likewise.
* libcollector/linetrace.c: Likewise.
* libcollector/mmaptrace.c: Likewise.
* libcollector/synctrace.c: Likewise.
* libcollector/libgprofng.ver: New file.
* libcollector/Makefile.in: Rebuild.
* libcollector/configure: Rebuild.
* libcollector/mapfile.aarch64-Linux: Removed.
* libcollector/mapfile.amd64-Linux: Removed.
* libcollector/mapfile.intel-Linux: Removed.
* libcollector/mapfile.sparc-Linux: Removed.
* libcollector/mapfile.sparcv9-Linux: Removed.

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


[Bug gas/30279] New: UBSAN error: /buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20

2023-03-27 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=30279

Bug ID: 30279
   Summary: UBSAN error:
/buildworker/marxinbox-cross-binutils-sanitizers/build
/gas/config/tc-m68hc11.c:708:20
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: mliska at suse dot cz
  Target Milestone: ---

The following fails when I build binutils with:
configure --build=x86_64-linux --disable-gdb --disable-gdbserver
--disable-werror --enable-obsolete --target=m68hc11-elf CFLAGS="-g -O2
-fsanitize=address,undefined -Wno-error"CXXLAGS="-g -O2
-fsanitize=address,undefined -Wno-error"LDFLAGS="-ldl"
Target: m68hc11-elf
FAIL: gas/all/multibyte2
Executing on host: ../as-new  -o empty1641.obj empty1641.s(timeout = 300)
/buildworker/marxinbox-cross-binutils-sanitizers/build/gas/config/tc-m68hc11.c:708:20:
runtime error: store to address 0x6260016c with insufficient space for an
object of type 'int'

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


[Bug gas/30277] GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

WHR  changed:

   What|Removed |Added

 Target|mips64-none-elfabi64|mips64-none-elfabi64
   ||(actually using extra
   ||target mips-none-elf)

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


[Bug gas/30277] GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

WHR  changed:

   What|Removed |Added

   Host||powerpc64-unknown-linux-gnu
 Target||mips64-none-elfabi64
  Build||powerpc64-unknown-linux-gnu

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


[Bug gas/30277] New: GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

Bug ID: 30277
   Summary: GNU as produce '.symtab' entries with incorrect order
for 32-bit MIPS target
   Product: binutils
   Version: 2.40
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: msl023508 at gmail dot com
  Target Milestone: ---

I have written a simple assembly code to test this issue:

$ cat sym-order-test.s
.text
.global func2, func4, func6
func1:
nop
func2:
nop
func3:
nop
func4:
nop
func5:
nop
func6:
nop
func7:
nop
$ mips64-none-elfabi64-as -mabi=32 sym-order-test.s -o sym-order-test.o   
$ readelf --symbols sym-order-test.o

Symbol table '.symtab' contains 15 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1:  0 SECTION LOCAL  DEFAULT1 .text
 2:  0 SECTION LOCAL  DEFAULT2 .data
 3:  0 SECTION LOCAL  DEFAULT3 .bss
 4:  0 SECTION LOCAL  DEFAULT4 .reginfo
 5:  0 SECTION LOCAL  DEFAULT5 .MIPS.abiflags
 6:  0 SECTION LOCAL  DEFAULT6 .pdr
 7:  0 SECTION LOCAL  DEFAULT7 .gnu.attributes
 8: 0004 0 NOTYPE  GLOBAL DEFAULT1 func2
 9: 000c 0 NOTYPE  GLOBAL DEFAULT1 func4
10: 0014 0 NOTYPE  GLOBAL DEFAULT1 func6
11:  0 NOTYPE  LOCAL  DEFAULT1 func1
12: 0008 0 NOTYPE  LOCAL  DEFAULT1 func3
13: 0010 0 NOTYPE  LOCAL  DEFAULT1 func5
14: 0018 0 NOTYPE  LOCAL  DEFAULT1 func7
$ mips64-none-elfabi64-as --version
GNU assembler (GNU Binutils) 2.40
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `mips64-none-elfabi64'.


As shown by readelf(1), there are some LOCAL symbols follow the last GLOBAL
symbol, this is not allowed by ELF specification.

This issue was raised by ld(1), which rejects the problematical object file
under some conditions:

$ mips64-none-elfabi64-ld -m elf32btsmip sym-order-test.o
mips64-none-elfabi64-ld: sym-order-test.o: .symtab local symbol at index 11 (>=
sh_info of 8)
mips64-none-elfabi64-ld: sym-order-test.o: error adding symbols: bad value

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


[Bug binutils/17512] libbfd/binutils: crashes on fuzzed samples

2023-03-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=17512

--- Comment #236 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

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

commit 695c322803476e92e1566c90470b6bb737a40514
Author: Alan Modra 
Date:   Sun Mar 26 19:26:46 2023 +1030

coffgrok access of u.auxent.x_sym.x_tagndx.p

u.auxent.x_sym.x_tagndx is a union.  The p field is only valid when
fix_tag is set.  This patch fixes code in coffgrok.c that accessed the
field without first checking fix_tag, and removes a whole lot of code
validating bogus pointers to prevent segfaults (which no longer
happen, I checked the referenced PR 17512 testcases).  The patch also
documents this in the fix_tag comment, makes is_sym a bitfield, and
sorts the selecter fields a little.

bfd/
* coffcode.h (combined_entry_type): Make is_sym a bitfield.
Sort and comment on union selectors.
* libcoff.h: Regenerate.
binutils/
* coffgrok.c (do_type): Make aux a combined_entry_type.  Test
fix_tag before accessing u.auxent.x_sym.x_tagndx.p.  Remove
now unnecessary pointer bounds checking.

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


[Bug ld/27565] ld: Support input section description keyword: REVERSE

2023-03-27 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27565

Nick Clifton  changed:

   What|Removed |Added

  Attachment #14772|0   |1
is obsolete||

--- Comment #5 from Nick Clifton  ---
Created attachment 14784
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14784=edit
Proposed patch

Please try this revised patch.

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


[Bug ld/27565] ld: Support input section description keyword: REVERSE

2023-03-27 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27565

--- Comment #4 from Nick Clifton  ---
(In reply to Fangrui Song from comment #3)

> Hi Nick, thanks for working on this feature! Do you have some examples how
> this keyword can be used?

The patch does include some new test cases which show the keyword being used.


> If I try
> (https://github.com/llvm/llvm-project/blob/main/lld/test/ELF/linkerscript/
> sort-init.s#L53):
> 
> 
> SECTIONS {
>   .init_array : {
> *(REVERSE(SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*))
> SORT_BY_INIT_PRIORITY(foo*))
> *(REVERSE(.init_array .ctors))
>   }
> }
> 
> ld reports `syntax error`.

Darn!   I included support for "REVERSE(SORT_BY_NAME(..." but not for
"REVERSE(SORT_BY_INIT_PRIORITY(..."  

I will update the patch...

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


[Bug gold/30187] ld.bfd and ld.gold versions in .comment section of ELF files

2023-03-27 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30187

Nick Clifton  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Nick Clifton  ---
Right - gold patch applied.

That takes care of both linkers, so I am closing this PR.

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


[Bug gold/30187] ld.bfd and ld.gold versions in .comment section of ELF files

2023-03-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=30187

--- Comment #17 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Nick Clifton :

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

commit eb42b9d6f914b233d740da88d5e21c6690170b7d
Author: Nick Clifton 
Date:   Mon Mar 27 11:10:10 2023 +0100

Add an option to the gold linker to put its version string into the
.comment section.

  PR 30187
  * options.h (class General_options): Add enable-linker-version.
  * layout.cc (Layout::create_gold_note): If linker-version is enabled put
the version string into the .comment section.

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