[Bug binutils/28581] nm/objdump --help display unsupported demangling styles

2021-11-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28581

Alan Modra  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2021-11-11

--- Comment #1 from Alan Modra  ---
I'm writing a new function for use in nm, objdump and readelf.

/* Print the list of demangling styles to STREAM.  A one line MSG is
   printed before the styles.  Output is limited to 80 columns, with
   continuation lines being indented by leading spaces in MSG.  */

void
display_demangler_styles (FILE *stream, const char *msg)

This should mean we never need worry about updating the --demangle usage
message as libiberty evolves.

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


[Bug libctf/28545] cross compile incorrectly using host libraries in install relink

2021-11-11 Thread nick.alcock at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28545

Nick Alcock  changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING

--- Comment #11 from Nick Alcock  ---
Hm. This is not easy to replicate. A straight cross build, even one with
--prefix=/usr and --disable-fast-install to force relinking, does not go wrong.

Looking at your compile command, what's breaking it is that something is
forcing
"-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib
-Wl,-rpath-link=/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib"
in front of the -o in the libtool command.

Looking at the compile log, the openwrt build scripts are passing *this* in:

LDFLAGS="-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/lib
-znow -zrelro "

This is a disaster waiting to happen (and now it has happened). You can't set
up sysroots by just passing in -L arguments in LDFLAGS like this! The problem
is that the resulting library search order is wrong: LDFLAGS is injected early
in link lines, and libraries are searched for in order of -L arguments, so any
libraries specified in -L will take precedence over any -L arguments specified
by binutils's actual makefiles to find its own libraries in the build tree, and
there's nothing we can do about it. -L arguments should only ever appear in
LIBS, accompanying specific libraries found in nonstandard paths.

The compiler should have been configured to find libraries suitably without
needing a massive spray of -L arguments like this: GCC has a --sysroot argument
for a reason (and --sysroot does not mess up the library search order). You
should probably raise this with OpenWRT (and link to this bug).

I am tempted to mark this INVALID right away, but I'll leave it as WAITING
until we see what the OpenWRT people say (since they probably do a lot more
cross-compiling than me, to be honest).

(But I clearly need to backport bug 27360 to the 2.37 branch. I'm on that.)

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


[Bug gold/28585] New: Invalid read of size 1 when using plugin

2021-11-11 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=28585

Bug ID: 28585
   Summary: Invalid read of size 1 when using plugin
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: mliska at suse dot cz
CC: ian at airs dot com
  Target Milestone: ---

The following crashes:

$ touch foobar && valgrind ./ld-new -plugin
/usr/lib64/gcc/x86_64-suse-linux/11/liblto_plugin.so foobar
==23259== Memcheck, a memory error detector
==23259== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23259== Using Valgrind-3.17.0.GIT and LibVEX; rerun with -h for copyright
info
==23259== Command: ./ld-new -plugin
/usr/lib64/gcc/x86_64-suse-linux/11/liblto_plugin.so foobar
==23259== 
./ld-new: error: foobar: file is empty
==23259== Invalid read of size 1
==23259==at 0x48441E2: strlen (vg_replace_strmem.c:469)
==23259==by 0x7023BC: string_length (stringpool.h:54)
==23259==by 0x7023BC: Hashkey (stringpool.h:350)
==23259==by 0x7023BC: gold::Stringpool_template::find(char const*,
unsigned long*) const (stringpool.cc:312)
==23259==by 0x707ACC: gold::Symbol_table::lookup(char const*, char const*)
const (symtab.cc:705)
==23259==by 0x6C8778: gold::Plugin_hook::run(gold::Workqueue*)
(plugin.cc:1766)
==23259==by 0x71F3F7: gold::Workqueue::find_and_run_task(int)
(workqueue.cc:319)
==23259==by 0x71F679: gold::Workqueue::process(int) (workqueue.cc:495)
==23259==by 0x4119F0: main (main.cc:252)
==23259==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

Can be fixed with simple patch:

diff --git a/gold/symtab.cc b/gold/symtab.cc
index 5a21ddc8cc2..ed6b5434592 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -701,6 +701,8 @@ Symbol_table::resolve_forwards(const Symbol* from) const
 Symbol*
 Symbol_table::lookup(const char* name, const char* version) const
 {
+  if (name == NULL)
+return NULL;
   Stringpool::Key name_key;
   name = this->namepool_.find(name, &name_key);
   if (name == NULL)

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


[Bug gold/28585] Invalid read of size 1 when using plugin

2021-11-11 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=28585

Martin Liska  changed:

   What|Removed |Added

 CC||iant at google dot com

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


[Bug gold/28494] gold combines different aligned/padded SHT_NOTE sections in the same PT_NOTE segment

2021-11-11 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=28494

--- Comment #6 from Martin Liska  ---
(In reply to H.J. Lu from comment #5)
> Fixed for 2.38.

Thanks. Is it something we can backport to 2.37?

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


[Bug libctf/28545] cross compile incorrectly using host libraries in install relink

2021-11-11 Thread bugs.sourceware at johnthomson dot fastmail.com.au
https://sourceware.org/bugzilla/show_bug.cgi?id=28545

--- Comment #12 from John  
---
Thank you Nick,
I will take this up again with OpenWrt
Sorry I had not done an out-of-openwrt cross compile

Just to make sure, I am seeing this error when I have both configure args:
--enable-shared --prefix=/usr
The error then shows during make install

I do not yet have a non-openwrt cross compile toolchain setup. I will try to
get this done.

In my recreate using the openwrt toolchain, but not build scripts, I (still)
see this error, without those unwanted OpenWrt LDFLAGS: will attach log.

curl -O
https://downloads.openwrt.org/snapshots/targets/ipq40xx/mikrotik/openwrt-sdk-ipq40xx-mikrotik_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

tar -xf openwrt-sdk-ipq40xx-mikrotik_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz
cd openwrt-sdk-ipq40xx-mikrotik_gcc-11.2.0_musl_eabi.Linux-x86_64

PATH="$PATH:$(realpath
staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/bin)"
export PATH

STAGING_DIR="$(realpath
staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi)"
export STAGING_DIR

cd dl
curl -LO 'http://mirror.downloadvn.com/gnu/binutils/binutils-2.37.tar.xz'
cd ../

mkdir temp
cd temp

curl -L -o libctf-link-against-libibierty-first.patch
'https://sourceware.org/git?p=binutils-gdb.git;a=patch;h=7d53105d6ed984aec255fa0eacd0405f3c1bb874'

tar -xf ../dl/binutils-2.37.tar.xz
cd binutils-2.37

patch -Np1 -i ../libctf-link-against-libibierty-first.patch

mkdir tmp


./configure --target=arm-openwrt-linux --host=arm-openwrt-linux
--build=x86_64-pc-linux-gnu --enable-shared --prefix=/usr 2>&1 | tee log
make 2>&1 | tee -a log
DESTDIR=$(realpath tmp) make install 2>&1 | tee -a log

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


[Bug libctf/28545] cross compile incorrectly using host libraries in install relink

2021-11-11 Thread bugs.sourceware at johnthomson dot fastmail.com.au
https://sourceware.org/bugzilla/show_bug.cgi?id=28545

--- Comment #13 from John  
---
Created attachment 13778
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13778&action=edit
Full compile log for OpenWrt (toolchain only) ipq40xx binutils 2.37

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


[Bug gold/28494] gold combines different aligned/padded SHT_NOTE sections in the same PT_NOTE segment

2021-11-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=28494

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_37-branch branch has been updated by H.J. Lu
:

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

commit bd711d6329ebb9328a99bd4be501932082248e44
Author: H.J. Lu 
Date:   Mon Oct 25 08:42:24 2021 -0700

gold: Place .note.gnu.property section before other note sections

Place the .note.gnu.property section before all other note sections to
avoid being placed between other note sections with different alignments.

PR gold/28494
* layout.cc (Layout::create_note): Set order to ORDER_PROPERTY_NOTE
for the .note.gnu.property section.
* layout.h (Output_section_order): Add ORDER_PROPERTY_NOTE.

(cherry picked from commit f85dcfc3af9cf7c2859241253f1d37b1133abea2)

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


[Bug gold/28494] gold combines different aligned/padded SHT_NOTE sections in the same PT_NOTE segment

2021-11-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28494

--- Comment #8 from H.J. Lu  ---
Also fixed on 2.37 branch.

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


[Bug binutils/28581] nm/objdump --help display unsupported demangling styles

2021-11-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=28581

--- Comment #2 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=0d64622696e02ad649d048f4af3a3f293481f89f

commit 0d64622696e02ad649d048f4af3a3f293481f89f
Author: Alan Modra 
Date:   Thu Nov 11 20:21:32 2021 +1030

Fix demangle style usage info

Extract allowed styles from libiberty, so we don't have to worry about
our help messages getting out of date.  The function probably belongs
in libiberty/cplus-dem.c but it can be here for a while to iron out
bugs.

PR 28581
* demanguse.c: New file.
* demanguse.h: New file.
* nm.c (usage): Break up output.  Use display_demangler_styles.
* objdump.c (usage): Use display_demangler_styles.
* readelf.c (usage): Likewise.
* Makefile.am: Add demanguse.c and demanguse.h.
* Makefile.in: Regenerate.
* po/POTFILESin: Regenerate.

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


[Bug binutils/28581] nm/objdump --help display unsupported demangling styles

2021-11-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28581

Alan Modra  changed:

   What|Removed |Added

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

--- Comment #3 from Alan Modra  ---
Fixed

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