[Bug ld/22920] Segfault in ld with RISC-V binary target

2018-03-06 Thread wilson at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22920

Jim Wilson  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |wilson at gcc dot 
gnu.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22920] Segfault in ld with RISC-V binary target

2018-03-06 Thread wilson at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22920

Jim Wilson  changed:

   What|Removed |Added

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

--- Comment #5 from Jim Wilson  ---
Nick, thanks for the pointer on how to fix this.  I committed a patch following
this recommendation, and the testcase now gives a linker error instead of
crashing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against note section without SHF_ALLOC

2018-03-06 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

--- Comment #7 from H.J. Lu  ---
(In reply to Nick Clifton from comment #5)
> Hi H.J.
> 
> > The value will be wrong.  Linker can only resolve PC relative relocations> 
> > against local definition.
> But can't the linker assume that the object is located at address 0 and
> resolve the relocations using that ?  It does not matter that this address
> will not match the run-time address of the object, it is only going to be
> used when performing a static analysis of the binary.

How these relocation should be resolved must be spelled out, probably in
.gnu.build.attributes specification.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against note section without SHF_ALLOC

2018-03-06 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

--- Comment #6 from Nick Clifton  ---
Created attachment 10873
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10873=edit
Assembler source for the object file

Hi H.J.

  Here is the assembler source.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against note section without SHF_ALLOC

2018-03-06 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

--- Comment #5 from Nick Clifton  ---
Hi H.J.

> The value will be wrong.  Linker can only resolve PC relative relocations> 
> against local definition.
But can't the linker assume that the object is located at address 0 and
resolve the relocations using that ?  It does not matter that this address
will not match the run-time address of the object, it is only going to be
used when performing a static analysis of the binary.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: [Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against note section without SHF_ALLOC

2018-03-06 Thread Nick Clifton
Hi H.J.

> The value will be wrong.  Linker can only resolve PC relative relocations> 
> against local definition.
But can't the linker assume that the object is located at address 0 and
resolve the relocations using that ?  It does not matter that this address
will not match the run-time address of the object, it is only going to be
used when performing a static analysis of the binary.

Cheers
  Nick



___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against note section without SHF_ALLOC

2018-03-06 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

--- Comment #3 from H.J. Lu  ---
(In reply to Nick Clifton from comment #2)
> Hi H.J.
> 
> > Since these relocations
> > are in non-allocatable sections, should linker treat them as in
> > debug section?
> 
> Ideally not.  If I understand the code correctly the debug relocations
> are just silently ignored.  They are not actually processed.  What I 
> would really like, if possible, is for the linker to resolve the
> relocations against the note section and update the section contents
> appropriately.  (I think that the linker can assume a base address of 0
> for these relocations).
> 

The value will be wrong.  Linker can only resolve PC relative relocations
against local definition.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] x86_64 linker seg-faults when creating a shared object from an input containg relocations against a note section

2018-03-06 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |WAITING
   Assignee|unassigned at sourceware dot org   |hjl.tools at gmail dot 
com
   Target Milestone|--- |2.31

--- Comment #1 from H.J. Lu  ---
Please provide testcase in assembly code.  Since these relocations
are in non-allocatable sections, should linker treat them as in
debug section?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22929] New: x86_64 linker seg-faults when creating a shared object from an input containg relocations against a note section

2018-03-06 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22929

Bug ID: 22929
   Summary: x86_64 linker seg-faults when creating a shared object
from an input containg relocations against a note
section
   Product: binutils
   Version: 2.31 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: nickc at redhat dot com
CC: hjl.tools at gmail dot com
  Target Milestone: ---

Created attachment 10870
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10870=edit
Object file for triggering seg-fault.

The x86_64 linker will generate a seg-fault when asked to create a shared
library from an input file that contains relocations against non-allocatable
sections.  For example try linking the attached object file with:

  ld -shared ifuncmod8.os

The problem in this case is that the input file contains relocations against
a note section.  At a minimum the linker should generate an error message and
exit with a failure code, but a better result would be if the linker could
resolve the relocations instead.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22920] Segfault in ld with RISC-V binary target

2018-03-06 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22920

Nick Clifton  changed:

   What|Removed |Added

 CC||nickc at redhat dot com

--- Comment #3 from Nick Clifton  ---
Hi Jim,

(In reply to Jim Wilson from comment #1)

> Your linker script sets the output format to binary.  Unfortunately, the
> current RISC-V linker only works for ELF output format.   

Some other targets issue an error message when this kind of format chaning
is encountered by the linker.  Do you think that it would be worthwhile
adding such code for the RiscV target ?  (Search for "cannot change output
format" in ld/emultempl/ for examples).

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/22923] readelf crashes with fuzzed samples 748 times

2018-03-06 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22923

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #10 from Alan Modra  ---
Patch OK, please apply

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils