[Bug gas/25235] Forward-referencing ADR instructions generate wrong offsets in Thumb code

2019-12-30 Thread dwelch at dwelch dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25235

dwelch at dwelch dot com changed:

   What|Removed |Added

 CC||dwelch at dwelch dot com

--- Comment #1 from dwelch at dwelch dot com ---
Both in do_adr and do_t_adr there are checks for S_IS_DEFINED and THUMB_IS_FUNC
before applying the required offset (to match the defined behavior of the tool
in its documentation).  But at the time of those checks a forward referenced
label is not yet defined so the correct offset is not computed.  Later when
handled as an add or subtract the implementation does not check for thumb nor
compute the correct offset.

do_t_adr for example:

  if (inst.relocs[0].exp.X_op == O_symbol
  && inst.relocs[0].exp.X_add_symbol != NULL
  && S_IS_DEFINED (inst.relocs[0].exp.X_add_symbol)   < here
  && THUMB_IS_FUNC (inst.relocs[0].exp.X_add_symbol)) < and here
inst.relocs[0].exp.X_add_number += 1;  < make |= 1 for cleanliness

There are further ADR thumb issues with respect to T16 and subtraction even
though this pseudo instruction can be handled in the same number of bytes as a
T32 (add rd,pc,#0, sub rd,#offset) so no excuse there for this error in general
(if the range is too far for either A32, T16, T32 solutions then sure error
out).

if (subtract || value & ~0x3fc)
  as_bad_where (fixP->fx_file, fixP->fx_line,
_("invalid immediate for address calculation (value =
0x%08lX)"),
(unsigned long) (subtract ? - value : value));

This is in the same area of code where the fix for this bug would want/need to
live.  If this needs to be filed as a separate bug to get this fixed then fine,
but might as well fix the whole ADR issue at once rather than in pieces, yes?

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


[Bug gas/25224] [Z80][PATCH] Add support for Zilog Z180 and eZ80 CPUs

2019-12-30 Thread sergey.belyashov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25224

Sergey Belyashov  changed:

   What|Removed |Added

  Attachment #12152|0   |1
is obsolete||

--- Comment #17 from Sergey Belyashov  ---
Created attachment 12154
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12154&action=edit
Add support for Z180 and eZ80 to bfd/gas/binutils/ld

Fix error, which causes invalid machine flags when linking to ELF output.

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


[Bug ld/18199] ld fails with -flto for mingw, wrong resolution for main

2019-12-30 Thread rai...@emrich-ebersheim.de
https://sourceware.org/bugzilla/show_bug.cgi?id=18199

Rainer Emrich  changed:

   What|Removed |Added

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

--- Comment #8 from Rainer Emrich  ---
(In reply to Hannes Domani from comment #7)
> (In reply to cvs-com...@gcc.gnu.org from comment #6)
> > The binutils-2_26-branch branch has been updated by Kwok Yeung
> > :
> > 
> > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> > h=412d26bde8585eca3ec6b8bed70197205288cbdf
> > 
> > commit 412d26bde8585eca3ec6b8bed70197205288cbdf
> > Author: Kwok Cheung Yeung 
> > Date:   Thu Dec 10 16:11:07 2015 +
> > 
> > ld: Fix LTO for MinGW targets
> > 
> > When creating a dummy BFD for an IR file, the output BFD is used as
> > a template for the new BFD, when it needs to be the input BFD passed
> > into the function when not dealing with a BFD plugin.
> > 
> > On most targets this is not an issue as the input and output formats
> > are the same anyway, but on MinGW targets, there are two variant
> > formats used (pe-i386/pe-x86-64 and pei-i386/pei-x86-64) which are
> > similar but not interchangeable here.
> > 
> > PR ld/18199
> > * plugin.c (plugin_get_ir_dummy_bfd): Use srctemplate as the
> > template when calling bfd_create if it does not use the BFD
> > plugin target vector.
> > 
> > (Cherry-picked from commit 4a07dc81356ed8728e204e9aabeb256703c59aef)
> 
> Wasn't this bug fixed with this commit?

Yes, I think that's fixed. At least it doesn't reproduce with newer versions.

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


[Bug ld/25210] aarch64: -fix-cortex-a53-835769 --fix-cortex-a53-843419 lead to invalid operation

2019-12-30 Thread icenowy at aosc dot io
https://sourceware.org/bugzilla/show_bug.cgi?id=25210

Icenowy Zheng  changed:

   What|Removed |Added

 CC||icenowy at aosc dot io

--- Comment #3 from Icenowy Zheng  ---
By bisecting, I found this in fact related to the fix of PR24753 , which
introduced an external SEC_LINKER_CREATED flag to the stub section.

This change seems bogus (at least not related to the problem reported in
PR24753 ).

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


[Bug ld/24753] [2.33 Regression] ld: section size (0x1e50 bytes) is larger than file size (0x5a0 bytes), can not size stub section: memory exhausted

2019-12-30 Thread icenowy at aosc dot io
https://sourceware.org/bugzilla/show_bug.cgi?id=24753

Icenowy Zheng  changed:

   What|Removed |Added

 CC||icenowy at aosc dot io

--- Comment #13 from Icenowy Zheng  ---
Sorry, but my bisecting shows that the fix for this PR lead to the regression
PR25210 , with the introduction of SEC_LINKER_CREATED to the AArch64 stubs
section.

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


[Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev.cst4' of mode_query_balls_distances.o: defined in discarded section `.text.__tcf_0[_ZNK6com

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25315

John David Anglin  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #11 from John David Anglin  ---
Gcc fix suggested in comment 8 has problems:

/home/dave/gnu/gcc/objdir/./prev-gcc/xg++
-B/home/dave/gnu/gcc/objdir/./prev-gcc
/ -B/home/dave/opt/gnu/gcc/gcc-10/hppa-linux-gnu/bin/ -nostdinc++
-B/home/dave/g
nu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs
-B/home/dave/gnu/gcc/ob
jdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs 
-I/home/dave/gnu/gcc/objd
ir/prev-hppa-linux-gnu/libstdc++-v3/include/hppa-linux-gnu 
-I/home/dave/gnu/gcc
/objdir/prev-hppa-linux-gnu/libstdc++-v3/include 
-I/home/dave/gnu/gcc/gcc/libst
dc++-v3/libsupc++
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/s
rc/.libs
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/
.libs -no-pie   -g -O2 -fno-checking -DIN_GCC -fno-exceptions -fno-rtti
-fas
ynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wn
o-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-W
no-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror  
-DHAVE_CONFI
G_H -static-libstdc++ -static-libgcc  -o d21 \
d/aav.o d/access.o d/aliasthis.o d/apply.o d/argtypes.o d/arrayop.o
d/at
trib.o d/blockexit.o d/canthrow.o d/checkedint.o d/clone.o d/cond.o
d/constfold.
o d/cppmangle.o d/ctfeexpr.o d/dcast.o d/dclass.o d/declaration.o
d/delegatize.o
 d/denum.o d/dimport.o d/dinterpret.o d/dmacro.o d/dmangle.o d/dmodule.o
d/doc.o
 d/dscope.o d/dstruct.o d/dsymbol.o d/dtemplate.o d/dversion.o d/entity.o
d/esca
pe.o d/expression.o d/expressionsem.o d/file.o d/filename.o d/func.o d/hdrgen.o
d/iasm.o d/iasmgcc.o d/identifier.o d/imphint.o d/init.o d/initsem.o
d/intrange.
o d/json.o d/lexer.o d/mtype.o d/nogc.o d/nspace.o d/objc.o d/opover.o
d/optimiz
e.o d/outbuffer.o d/parse.o d/rmem.o d/rootobject.o d/safe.o d/sapply.o
d/sideef
fect.o d/speller.o d/statement.o d/statementsem.o d/staticassert.o
d/staticcond.
o d/stringtable.o d/tokens.o d/traits.o d/typesem.o d/utf.o d/utils.o d/id.o
d/i
mpcnvtab.o d/d-attribs.o d/d-builtins.o d/d-codegen.o d/d-convert.o
d/d-diagnost
ic.o d/d-frontend.o d/d-incpath.o d/d-lang.o d/d-longdouble.o d/d-target.o
d/dec
l.o d/expr.o d/imports.o d/intrinsics.o d/modules.o d/runtime.o d/toir.o
d/typei
nfo.o d/types.o glibc-d.o pa-d.o attribs.o libbackend.a main.o
libcommon-target.
a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a
../l
ibcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
.
./libdecnumber/libdecnumber.a  -lisl -lmpc -lmpfr -lgmp -rdynamic -ldl 
-L./../z
lib -lz -lzstd
`.LC14' referenced in section `.text' of d/declaration.o: defined in discarded
section `.rodata._ZN7Dsymbol8isNspaceEv[_ZN7Dsymbol8isNspaceEv]' of
d/declaration.o
`.LC14' referenced in section `.text' of d/declaration.o: defined in discarded
section `.rodata._ZN7Dsymbol8isNspaceEv[_ZN7Dsymbol8isNspaceEv]' of
d/declaration.o

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


[Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev.cst4' of mode_query_balls_distances.o: defined in discarded section `.text.__tcf_0[_ZNK6com

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25315

--- Comment #12 from John David Anglin  ---
Created attachment 12155
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12155&action=edit
Buggy patch

With the patch, we now get plabels in .rodata comdat sections with same key as
the function.  However, this creates a problem with local references to the
plabel.

.section   
.text._ZN7Dsymbol8isNspaceEv,"axG",@progbits,_ZN7Dsymbol8isNspaceEv,comdat
.align 4
.weak   _ZN7Dsymbol8isNspaceEv
.type   _ZN7Dsymbol8isNspaceEv, @function
_ZN7Dsymbol8isNspaceEv:
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
.LVL12:
.LFB641:
.loc 2 247 21 is_stmt 1 view -0
.cfi_startproc
.loc 2 247 34 view .LVU35
.loc 2 247 46 is_stmt 0 view .LVU36
bv %r0(%r2)
ldi 0,%r28
.EXIT
.PROCEND
.cfi_endproc
.LFE641:
.size   _ZN7Dsymbol8isNspaceEv, .-_ZN7Dsymbol8isNspaceEv


.section   
.rodata._ZN7Dsymbol8isNspaceEv,"aG",@progbits,_ZN7Dsymbol8isNspaceEv,comdat
.align 4
.LC14:
.word   P%_ZN7Dsymbol8isNspaceEv


ldil LR'.LC14,%r28
ldo RR'.LC14(%r28),%r28
bl __canonicalize_funcptr_for_compare,%r2
.LVL218:
ldw 0(%r28),%r26


It seems to me that we have to leave the plabel, make sure it's null when it
refers to a discarded function, and suppress the error in ld.  Otherwise, the
linker would need to patch the above sequence into three nop instructions and
a ldi 0,%r28.

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


[Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev.cst4' of mode_query_balls_distances.o: defined in discarded section `.text.__tcf_0[_ZNK6com

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25315

--- Comment #13 from John David Anglin  ---
Created attachment 12156
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12156&action=edit
Patch

It would be better if we only ignored deleted PLABEL32 relocations to discarded
COMDAT functions.

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


[Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev.cst4' of mode_query_balls_distances.o: defined in discarded section `.text.__tcf_0[_ZNK6com

2019-12-30 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=25315

--- Comment #14 from dave.anglin at bell dot net ---
On 2019-12-30 3:06 p.m., danglin at gcc dot gnu.org wrote:
> It would be better if we only ignored deleted PLABEL32 relocations to 
> discarded
> COMDAT functions.
Maybe function references could go into their own .rodata and .data sections.

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


[Bug ld/25285] FAIL: Run with libfunc1.so comm1.o with GCC 10

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25285

John David Anglin  changed:

   What|Removed |Added

 CC||danglin at gcc dot gnu.org

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


[Bug ld/25326] New: FAIL: Run pr19579

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25326

Bug ID: 25326
   Summary: FAIL: Run pr19579
   Product: binutils
   Version: 2.34 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
  Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
 Build: hppa-unknown-linux-gnu

With gcc-10:

Executing on host: sh -c {gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-
L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/
usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr19579 
-L/home/dave/gnu/binutils/
src/ld/testsuite/ld-elf -pie -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o
tmpdir
/libpr19579.so tmpdir/dummy.o  2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
Running: tmpdir/pr19579 > tmpdir/pr19579.out
diff tmpdir/pr19579.out
/home/dave/gnu/binutils/src/ld/testsuite/ld-elf/pass.out
0a1
> PASS
child process exited abnormally
FAIL: Run pr19579

Similar fail:
FAIL: Run pr19579 (-z now)

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


[Bug ld/25327] New: FAIL: Run pr20276

2019-12-30 Thread danglin at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25327

Bug ID: 25327
   Summary: FAIL: Run pr20276
   Product: binutils
   Version: 2.34 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
  Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
 Build: hppa-unknown-linux-gnu

With gcc-10:

gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I/home/dave/gnu/binutils/sr
c/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto -O2 -c
/home/dave/gnu/binutils
/src/ld/testsuite/ld-plugin/dummy.c -o tmpdir/dummy.o
Executing on host: sh -c {gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I
/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto -O2
-c /home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/dummy.c -o tmpdir/dummy.o
2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa
-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib -L=/usr/local/lib -L=/lib
-L=/
usr/lib  -o tmpdir/pr20276 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin
 -O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o tmpdir/dummy.o
Executing on host: sh -c {gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr20276 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -O2 -flto
tmpdir/pr20276a.o tmpdir/pr20276b.o tmpdir/dummy.o  2>&1}  /dev/null ld.tmp
(timeout = 300)
spawn [open ...]
/home/dave/gnu/binutils/objdir/ld/.libs/lt-ld-new: tmpdir/pr20276b.o (symbol
from plugin): in function `global_var':
(.text+0x0): multiple definition of `global_var';
tmpdir/pr20276a.o:/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/pr20276a.c:3:
first defined here
collect2: error: ld returned 1 exit status
/home/dave/gnu/binutils/objdir/ld/.libs/lt-ld-new: tmpdir/pr20276b.o (symbol
from plugin): in function `global_var':
(.text+0x0): multiple definition of `global_var';
tmpdir/pr20276a.o:/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/pr20276a.c:3:
first defined here
collect2: error: ld returned 1 exit status
FAIL: Run pr20276
gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto
-O2 -c /home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/dummy.c -o
tmpdir/dummy.o
Executing on host: sh -c {gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto
-O2 -c /home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/dummy.c -o
tmpdir/dummy.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr20267a 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -O2 -flto
tmpdir/pr20267a.o tmpdir/libpr20267a.a tmpdir/dummy.o
Executing on host: sh -c {gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr20267a 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -O2 -flto
tmpdir/pr20267a.o tmpdir/libpr20267a.a tmpdir/dummy.o  2>&1}  /dev/null ld.tmp
(timeout = 300)
spawn [open ...]
Running: tmpdir/pr20267a > tmpdir/pr20267a.out
child killed: SIGABRT
FAIL: Run pr20267a
gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto
-O2 -c /home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/dummy.c -o
tmpdir/dummy.o
Executing on host: sh -c {gcc  -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/
-I/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -g -O2   -c -g -O2 -flto
-O2 -c /home/dave/gnu/binutils/src/ld/testsuite/ld-plugin/dummy.c -o
tmpdir/dummy.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr20267b 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -O2 -flto
tmpdir/pr20267a.o tmpdir/libpr20267b.a tmpdir/dummy.o
Executing on host: sh -c {gcc -B/home/dave/gnu/binutils/objdir/ld/tmpdir/ld/  
-L=/home/dave/opt/test/hppa-unknown-linux-gnu/lib -L=/home/dave/opt/test/lib
-L=/usr/local/lib -L=/lib -L=/usr/lib  -o tmpdir/pr20267b 
-L/home/dave/gnu/binutils/src/ld/testsuite/ld-plugin -O2 -flto
tmpdir/pr20267a.o tmpdir/libpr20267b.a tmpdir/dummy.o  2>&1}  /dev/null ld.tmp
(timeout = 300)
spawn [open ...]
Running: tmpdir/pr20267b > tmpdir/pr20267b.out
child killed: SIGABRT
FAIL: Run pr20267b

-- 
You are rece