[Bug gold/25617] Gold looks up shared object information in section headers instead of the dynamic array

2020-03-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25617

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2020-03-01
 CC||hjl.tools at gmail dot com
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
Please provide a testcase.  A small binary file is OK.

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


[Bug ld/25618] New: use of gcc lto breaks --exclude-libs

2020-03-01 Thread sergeev917 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25618

Bug ID: 25618
   Summary: use of gcc lto breaks --exclude-libs
   Product: binutils
   Version: 2.34
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: sergeev917 at gmail dot com
  Target Milestone: ---

Created attachment 12329
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12329&action=edit
source files and shell validation script

(Originally reported to GCC bug tracker:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93980)

The apparent issue is that with LTO disabled -Wl,--exclude-libs,ALL flag works
as intended, but with -flto -- symbols from linked archives are not hidden
anymore.

The issue is easily reproduced with about 10 lines of code with no std libs
involved. The reproducer consists of a static library "foo" and a shared
library "bar" that links with "foo" (and we would like to hide "foo" symbols in
"bar").

foo.h:
#pragma once
__attribute__((visibility("default"))) int foo();

foo.cc:
#include "foo.h"
int foo() { return 100; }

bar.h:
#pragma once
__attribute__((visibility("default"))) int bar();

bar.cc:
#include "bar.h"
#include "foo.h"
int bar() { return foo(); }

Build commands:
g++ -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -flto -c foo.cc -o
.foo.o
ar qc .foo.a .foo.o
g++ -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -flto -c bar.cc -o
.bar.o
g++ -Wl,--exclude-libs,ALL -flto -shared -o libbar.so .bar.o .foo.a
readelf --dyn-syms --wide libbar.so | c++filt

The last command produces both bar() and foo() -- that is, foo() is not hidden.
Replacing -flto with -fno-lto gives only bar(), which is the expected result.
The issue is present when using both ld.bfd and ld.gold (ie -fuse-ld=gold).

--

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-9.2.0-r4/work/gcc-9.2.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/python
--enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --disable-nls --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 9.2.0-r4 p5'
--disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto
--disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--with-multilib-list=m64 --disable-altivec --disable-fixed-point
--enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp
--disable-systemtap --enable-vtable-verify --enable-lto --without-isl
--enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 9.2.0 (Gentoo 9.2.0-r4 p5)

$ ld -v
GNU ld (Gentoo 2.34 p1) 2.34.0

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


[Bug ld/25618] use of gcc lto breaks --exclude-libs

2020-03-01 Thread sergeev917 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25618

--- Comment #1 from Alexander Sergeyev  ---
A patch for the issue is proposed by H.J. Lu (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93980#c4). 

diff --git a/ld/plugin.c b/ld/plugin.c
index 47c053e5a0a..5960df65243 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1242,6 +1242,8 @@ plugin_object_p (bfd *ibfd)
   ibfd->plugin_format = bfd_plugin_yes;
   ibfd->plugin_dummy_bfd = abfd;
   bfd_make_readable (abfd);
+  if (ibfd->my_archive != NULL)
+  abfd->no_export = ibfd->my_archive->no_export;
   return abfd->xvec;
 }
   else

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


Issue 20368 in oss-fuzz: binutils:fuzz_disassemble: Undefined-shift in m32c_cgen_extract_operand

2020-03-01 Thread sheriffbot via monorail
Updates:
Labels: -restrict-view-commit

Comment #3 on issue 20368 by sheriffbot: binutils:fuzz_disassemble: 
Undefined-shift in m32c_cgen_extract_operand
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20368#c3

This bug has been fixed for 30 days. It has been opened to the public.

- Your friendly Sheriffbot

-- 
You received this message because:
  1. You were specifically CC'd on the issue

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Reply to this email to add a comment.

[Bug ld/25618] use of gcc lto breaks --exclude-libs

2020-03-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25618

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
URL||https://sourceware.org/ml/b
   ||inutils/2020-03/msg0.ht
   ||ml
   Last reconfirmed||2020-03-01
 CC||hjl.tools at gmail dot com
   Target Milestone|--- |2.35
 Ever confirmed|0   |1

--- Comment #2 from H.J. Lu  ---
A patch is posted at

https://sourceware.org/ml/binutils/2020-03/msg0.html

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


[Bug ld/25618] use of gcc lto breaks --exclude-libs

2020-03-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25618

H.J. Lu  changed:

   What|Removed |Added

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

--- Comment #3 from H.J. Lu  ---
Fixed for 2.35.

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


[Bug ld/25618] use of gcc lto breaks --exclude-libs

2020-03-01 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25618

--- Comment #4 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

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

commit 2aa90762b71af7f04032d2bebed6470070d3d801
Author: H.J. Lu 
Date:   Sun Mar 1 17:07:12 2020 -0800

plugin: Copy the no_export field to the IR dummy object

Copy the no_export field to the IR dummy object when claiming an IR
object.

PR ld/25618
* plugin.c (plugin_object_p): Copy the no_export field to the IR
dummy object.
* testsuite/ld-plugin/lto.exp (lto_link_elf_tests): Add
PR ld/25618 tests.
* testsuite/ld-plugin/pr25618.d: New file.
* testsuite/ld-plugin/pr25618a.cc: Likewise.
* testsuite/ld-plugin/pr25618a.h: Likewise.
* testsuite/ld-plugin/pr25618b.cc: Likewise.
* testsuite/ld-plugin/pr25618b.h: Likewise.

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


[Bug gold/25617] Gold looks up shared object information in section headers instead of the dynamic array

2020-03-01 Thread klkblake at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25617

--- Comment #2 from Kaylee  ---
Created attachment 12331
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12331&action=edit
testcase with no section headers

This test case has no section headers; gold immediately errors due to
attempting to read the nonexistent header for `.shstrtab`.

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


[Bug gold/25617] Gold looks up shared object information in section headers instead of the dynamic array

2020-03-01 Thread klkblake at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25617

--- Comment #3 from Kaylee  ---
Created attachment 12332
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12332&action=edit
testcase with only shstrtab

This testcase has a minimal section header table containing only `.shstrtab`.
This works around the previous error, but linking against it fails anyway as
gold only tries to find `.dynsym` through the section header table.

Both test cases expose a single function, `run()`, that does nothing but
return.

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


[Bug binutils/25136] mips64: set abi as N64 when the ABI section triple is gnuabi64

2020-03-01 Thread mattst88 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25136

Matt Turner  changed:

   What|Removed |Added

 CC||mattst88 at gmail dot com

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


[Bug binutils/25136] mips64: set abi as N64 when the ABI section triple is gnuabi64

2020-03-01 Thread syq at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25136

--- Comment #3 from YunQiang Su  ---
we need to fix the testsuite

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