[Bug ld/23357] LD debug info cannot be read by valgrind

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

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #5 from H.J. Lu  ---
(In reply to dilyan.palau...@aegee.org from comment #0)

> This means that valgrind cannot read debug information when most current ld
> is used, but can read the information when gold or ld 2.30 are used.  The
> fact that gdb can read the information in all cases does not prove that the
> problem is in valgrind, it could be also in the common libbdf.
> 
> Please verify that the debug information generated by ld is correct and help
> at https://bugs.kde.org/show_bug.cgi?id=395682 to find what the problem with
> valgrind is.

The bug is most likely in valgrind DWARF reader.

-- 
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/23357] LD debug info cannot be read by valgrind

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

--- Comment #6 from H.J. Lu  ---
Here is a tiny program:

https://github.com/hjl-tools/simple-linux/tree/divide-by-zero

Valgrind can't read its DWARF debug info:

[hjl@gnu-cfl-1 simple-linux]$ make LD=ld.gold
gcc -g -O0   -c -o test.o test.c
test.c: In function \u2018main\u2019:
test.c:22:9: warning: division by zero [-Wdiv-by-zero]
   i = 7 / 0;
 ^
gcc -g   -c -o start.o start.S
gcc -g   -c -o syscall.o syscall.S
ld.gold  -o test test.o start.o syscall.o
./test hello world
a
make: *** [Makefile:12: all] Floating point exception
[hjl@gnu-cfl-1 simple-linux]$ valgrind ./test
==27555== Memcheck, a memory error detector
==27555== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==27555== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==27555== Command: ./test
==27555== 
a
==27555== 
==27555== Process terminating with default action of signal 8 (SIGFPE)
==27555==  Integer divide by zero at address 0x1002B95532
==27555==at 0x40015E: ??? (in /export/ssd/git/github/simple-linux/test)
==27555==by 0x4001A8: ??? (in /export/ssd/git/github/simple-linux/test)
==27555== 
==27555== HEAP SUMMARY:
==27555== in use at exit: 0 bytes in 0 blocks
==27555==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==27555== 
==27555== All heap blocks were freed -- no leaks are possible
==27555== 
==27555== For counts of detected and suppressed errors, rerun with: -v
==27555== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Floating point exception
[hjl@gnu-cfl-1 simple-linux]$ gdb test
GNU gdb (GDB) Fedora 8.1-19.fc28
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...done.
(gdb) r
Starting program: /export/ssd/git/github/simple-linux/test 
a

Program received signal SIGFPE, Arithmetic exception.
0x0040015c in main (argc=1, argv=0x7fffd708) at test.c:22
22i = 7 / 0;
(gdb)

-- 
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/23357] LD debug info cannot be read by valgrind

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

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #7 from H.J. Lu  ---
This is a valgrind issue.

-- 
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/23401] New: binary size increases for ARM between 2.29.1 and 2.30

2018-07-11 Thread eb at emlix dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23401

Bug ID: 23401
   Summary: binary size increases for ARM between 2.29.1 and 2.30
   Product: binutils
   Version: 2.30
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: eb at emlix dot com
  Target Milestone: ---

These are the sizes of several binaries in an embedded ARM system where the
only change is a switch from binutils 2.29.1 (lines with +) to 2.30 (lines with
-):

-/tmp/e2/root/sysroot/usr/sbin/fw_printenvsize   4 
4
+/tmp/e2/root/sysroot/usr/sbin/fw_printenvsize   22180 
22180
-/tmp/e2/root/sysroot/usr/sbin/kexec  size   108416
108416
+/tmp/e2/root/sysroot/usr/sbin/kexec  size   108372
108372
-/tmp/e2/root/sysroot/usr/sbin/mtdinfosize   38460 
38460
+/tmp/e2/root/sysroot/usr/sbin/mtdinfosize   38416 
38416
-/tmp/e2/root/sysroot/usr/sbin/ubiattach  size   26184 
26184
+/tmp/e2/root/sysroot/usr/sbin/ubiattach  size   26140 
26140
-/tmp/e2/root/sysroot/usr/sbin/ubiformat  size   59032 
59032
+/tmp/e2/root/sysroot/usr/sbin/ubiformat  size   58988 
58988
-/tmp/e2/root/sysroot/usr/sbin/ubinfo size   30276 
30276
+/tmp/e2/root/sysroot/usr/sbin/ubinfo size   26136 
26136
-/tmp/e2/root/sysroot/lib/ld-uClibc-1.0.30.so size   21400 
21400
+/tmp/e2/root/sysroot/lib/ld-uClibc-1.0.30.so size   21356 
21356
-/tmp/e2/root/sysroot/lib/libgcc_s.so.1   size   137020
137020
+/tmp/e2/root/sysroot/lib/libgcc_s.so.1   size   124688
124688
-/tmp/e2/root/sysroot/lib/libuClibc-1.0.30.so size   362024
362024
+/tmp/e2/root/sysroot/lib/libuClibc-1.0.30.so size   353788
353788
-/tmp/e2/root/sysroot/usr/lib/libmbedcrypto.so.2  size   129308
129308
+/tmp/e2/root/sysroot/usr/lib/libmbedcrypto.so.2  size   125168
125168
-/tmp/e2/root/sysroot/usr/lib/libmbedtls.so.10size   42888 
42888
+/tmp/e2/root/sysroot/usr/lib/libmbedtls.so.10size   38748 
38748
-/tmp/e2/root/sysroot/usr/lib/libmbedx509.so.0size   42664 
42664
+/tmp/e2/root/sysroot/usr/lib/libmbedx509.so.0size   42620 
42620

Default CFLAGS for the binaries are "-Os -g
-Wl,--no-copy-dt-needed-entries,--as-needed", binutils has been built with
"CFLAGS='-O2 -pipe  -DCPU_DEFAULT=ARM_ARCH_V5TEJ' ../binutils/configure
--target=arm-linux-uclibcgnueabi --host=i586-pc-linux-gnu
--build=i586-pc-linux-gnu --program-prefix=arm-linux-uclibcgnueabi-
--disable-werror --enable-deterministic-archives --with-float=soft
--disable-multilib" and all binaries have been stripped using "objcopy
--strip-unneeded".

-- 
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/23350] multiple prevailing defs for unused variable in lto mode

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

H.J. Lu  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=86490
 Resolution|--- |INVALID

--- Comment #8 from H.J. Lu  ---
This is a GCC bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86490

-- 
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/22269] Undefined weak symbols isn't resolved to 0 in static PIE

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

--- Comment #35 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_31-branch branch has been updated by Max Filippov
:

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

commit 82f32155837415d3f84ceb9c9ffa36495f7211ae
Author: Max Filippov 
Date:   Mon Jul 2 11:12:44 2018 -0700

xtensa: don't emit dynamic relocation for weak undefined symbol

Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:

  void weak_function (void);
  if (weak_function)
weak_function ();

This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.

bfd/
2018-07-11  Max Filippov  

* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.

(cherry picked from commit c451bb34ae8bd2d0669bd563366883cfbcf0de9b)

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

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

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

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

commit 9143e72c6d4ddefbcb41c0f6361ad140354145ef
Author: Maciej W. Rozycki 
Date:   Wed Jul 11 17:44:45 2018 +0100

PR ld/22570: MIPS/BFD: Fix TLS relocation resolution for PIE executables

Correct a commit 0e1862bb401f ("Add output_type to bfd_link_info") issue
and use `bfd_link_dll' rather than `bfd_link_pic' in determining whether
to fully resolve GD, LD and IE TLS relocations referring to symbols
locally defined rather than deferring them to the load time by means of
dynamic relocations.

Such symbols cannot be preempted in PIE executables, which are
necessarily PIC, and therefore their values (thread pointer offsets) are
fixed at the static link time as is the associated module ID of the main
executable.

Given the `tlsbin-o32.s' and `tlsdyn-o32.s' sources from our test suite
this removes the absolute TLS relocations from the static:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
102c R_MIPS_TLS_TPREL32  *ABS*
1030 R_MIPS_TLS_DTPMOD32  *ABS*
1038 R_MIPS_TLS_DTPMOD32  *ABS*

and the dynamic:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
102c R_MIPS_TLS_TPREL32  *ABS*
1038 R_MIPS_TLS_DTPMOD32  *ABS*
1044 R_MIPS_TLS_DTPMOD32  *ABS*
1030 R_MIPS_TLS_DTPMOD32  tlsvar_gd
1034 R_MIPS_TLS_DTPREL32  tlsvar_gd
1040 R_MIPS_TLS_TPREL32  tlsvar_ie

PIE executable respectively, as reported by `objdump -R', and fills the
corresponding GOT slots with the values expected, as recorded with the
test cases added.  The new output from `objdump -R' is:

DYNAMIC RELOCATION RECORDS (none)

and:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
1030 R_MIPS_TLS_DTPMOD32  tlsvar_gd
1034 R_MIPS_TLS_DTPREL32  tlsvar_gd
1040 R_MIPS_TLS_TPREL32  tlsvar_ie

for the static and the dynamic executable respectively.

2018-07-11  Maciej W. Rozycki  
Rich Felker  

bfd/
PR ld/22570
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `bfd_link_pic' to determine whether dynamic relocations are
to be produced.
(mips_elf_initialize_tls_slots): Likewise.

ld/
PR ld/22570
* testsuite/ld-mips-elf/tlsbin-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsbin-pie-o32.got: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.got: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-07-11 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

Maciej W. Rozycki  changed:

   What|Removed |Added

 CC||ma...@linux-mips.org
 Resolution|DUPLICATE   |FIXED
   Assignee|unassigned at sourceware dot org   |ma...@linux-mips.org

--- Comment #6 from Maciej W. Rozycki  ---
Not really a duplicate, and fixed now.

-- 
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