[Bug binutils/18672] New: readelf does not show the last entries in .dynamic section

2015-07-14 Thread simon at atanasyan dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18672

Bug ID: 18672
   Summary: readelf does not show the last entries in .dynamic
section
   Product: binutils
   Version: 2.25
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: simon at atanasyan dot com
  Target Milestone: ---

Created attachment 8438
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8438&action=edit
Patch to fix the bug

readelf does not show the last entries in .dynamic section under the following
conditions:
 - readelf is built for a target with 64-bit pointers
 - readelf input is a binary built for a target with 32-bit pointer
 - .dynamic section size exactly equals to number of entries * 4-byte

The problem is in the following code from the get_32bit_dynamic_section
function. Suppose the last two entries in the .dynamic section is DT_PLTGOT and
DT_NULL. They both occupy 16 bytes. On 64-bit host the size of Elf_Internal_Dyn
is 16 bytes so the readelf stops iterating too early and misses the DT_PLTGOT
entry. Attached patch fixes the bug.

Elf32_External_Dyn * edyn;
Elf32_External_Dyn * ext;
Elf_Internal_Dyn * entry;

...

for (ext = edyn, dynamic_nent = 0;
 (char *) ext < (char *) edyn + dynamic_size - sizeof (* entry);
 ext++)
  {

-- 
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 gas/19977] New: [mips] gas writes incorrect addendum for %tprel_hi relocation

2016-04-21 Thread simon at atanasyan dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19977

Bug ID: 19977
   Summary: [mips] gas writes incorrect addendum for %tprel_hi
relocation
   Product: binutils
   Version: 2.27 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: simon at atanasyan dot com
  Target Milestone: ---

gas does not extract "hi" value from the %tprel_hi relocation's arguments and
writes the addendum as is. That makes impossible to use addends greater than
0x.

% cat tprel.s
  .text
foo:
  lui $3,%tprel_hi($loc0+0x7ffc)
  addiu   $3,$3,%tprel_lo($loc0+0x7ffc)

  .section .tdata,"awT",%progbits
$loc0:
  .word 0

% as -EB -mips32 -mabi=32 tprel.s
% objdump -dr a.out
...
 :
   0:   3c037ffclui v1,0x7ffc
0: R_MIPS_TLS_TPREL_HI16$loc0
   4:   24637ffcaddiu   v1,v1,32764
4: R_MIPS_TLS_TPREL_LO16$loc0

-- 
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 gas/19977] [mips] gas writes incorrect addendum for %tprel_hi relocation

2016-04-21 Thread simon at atanasyan dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19977

Simon Atanasyan  changed:

   What|Removed |Added

 CC||ma...@linux-mips.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