[Bug binutils/21191] objcopy --only-keep-debug creates non-monotonically increasing section offsets

2017-02-21 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21191

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||amodra at gmail dot com
 Resolution|--- |WONTFIX

--- Comment #1 from Alan Modra  ---
File offset for a SHT_NOBITS section is irrelevant.

Note that this "bug" can also occur with ld.  You don't want to waste space in
the output file with padding for NOBITS sections, but glibc ld.so checks that
p_vaddr and p_offset agree modulo pagesize, even for segments with p_filesz
zero.  Thus p_offset needs to be adjusted to pacify glibc.  p_offset is derived
from sh_offset so we adjust sh_offset too.

We could zero all the NOBITS sh_offset values for this specific case of
--only-keep-debug, but I don't see the point given that ld will create out of
order sh_offset.

What tool was complaining about sh_offset?  Fix it please.

-- 
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 gold/21040] Gold fails with GCC 4.2

2017-02-21 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21040

--- Comment #9 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_27-branch branch has been updated by Alan Modra
:

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

commit c8dbc58e0a9be82937b5875fe53412e260a6cc42
Author: H.J. Lu 
Date:   Fri Jan 13 07:46:14 2017 -0800

Gold: Fix build with GCC 4.2

PR gold/21040
* powerpc.cc (Powerpc_relobj::make_toc_relative):
Cast 0x80008000 to uint64_t.

-- 
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 gold/20878] gold powerpc64 le linux fails to link large Linux kernel

2017-02-21 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20878

--- Comment #8 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_27-branch branch has been updated by Alan Modra
:

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

commit 983d1db4d7b5644b8c16a64bb6cb7267f602ebef
Author: Alan Modra 
Date:   Wed Dec 7 14:12:26 2016 +1030

[GOLD] powerpc64le-linux fails to link large Linux kernel

Gold attaches stubs to an existing section in contrast to ld.bfd which
inserts a new section for stubs.  If we want stubs before branches,
then the stubs must be added to the previous section.  Adding to the
previous section is a disaster if there is a large gap between the
previous section and the group.

PR gold/20878
* powerpc.cc (Stub_control): Replace stubs_always_before_branch_
with stubs_always_after_branch_, group_end_addr_ with
group_start_addr_.
(Stub_control::can_add_to_stub_group): Rewrite to suit scanning
sections by increasing address.
(Target_powerpc::group_sections): Scan that way.  Delete corner
case.
* options.h (--stub-group-size): Update help string.

-- 
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 gold/20529] Gold [powerpc] - relaxing loop never ends

2017-02-21 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20529

--- Comment #2 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_27-branch branch has been updated by Alan Modra
:

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

commit cd54b50e7b5ac662ca52d636c01dfaa506cdb07b
Author: Han Shen 
Date:   Fri Aug 26 15:50:15 2016 -0700

PR gold/20529 - relaxing loop never ends.

* powerpc.cc (Stub_table::min_size_threshold_): New member to
limit size.
(Stub_table::set_min_size_threshold): New member function.
(Stub_table::set_address_and_size): Add code to only allow size
increase.
(Target_powerpc::do_relax): Add code to record last size.

-- 
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 gold/20523] powerpc64le kernel build with additional cross section references fails

2017-02-21 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20523

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_27-branch branch has been updated by Alan Modra
:

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

commit 2ec4b4a8bc3b056b710710fc24ecdd19d6c9670a
Author: Alan Modra 
Date:   Tue Aug 30 11:58:05 2016 +0930

[GOLD] correct grouping of stubs

This patch rewrites the rather obscure can_add_to_stub_group, fixing
a problem with the handling of sections containing conditional
external branches.  When a section group contains any such section,
the group size needs to be limited to a much smaller size than groups
with only non-conditional external branches.

PR 20523
* powerpc.cc (class Stub_control): Add has14_.  Comment owner_.
(Stub_control::can_add_to_stub_group): Correct grouping of
sections containing 14-bit external branches.  When returning
false, set state_ to reflect the fact that we have one section
for the next group.  Rewrite most of function for clarity.
Add and expand comments.
(Target_powerpc::do_relax): Print stub group size retry in hex.

-- 
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 gold/20807] gold assertion failure on aarch64 branch target in SHF_MERGE rodata section: internal error in set_merged_symbol_value, at ../../binutils-2.27/gold/object.h:1718

2017-02-21 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20807

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_27-branch branch has been updated by Alan Modra
:

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

commit 93ac3bd2dbc5388794801dc4caf5cb27a23fecb0
Author: Cary Coutant 
Date:   Thu Dec 1 12:50:21 2016 -0800

Fix internal error when relaxing branches to STT_SECTION symbols.

gold/
PR gold/20807
* aarch64.cc (Target_aarch64::scan_reloc_section_for_stubs): Handle
section symbols correctly.
* arm.cc (Target_arm): Likewise.
* powerpc.cc (Target_powerpc): Likewise.

-- 
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/21191] New: objcopy --only-keep-debug creates non-monotonically increasing section offsets

2017-02-21 Thread rguenth at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21191

Bug ID: 21191
   Summary: objcopy --only-keep-debug creates non-monotonically
increasing section offsets
   Product: binutils
   Version: 2.29 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

int main()
{
}

> gcc t.c -g
> objcopy --only-keep-debug a.out a.out.debug
> readelf -S a.out 
There are 39 section headers, starting at offset 0x2788:

Section Headers:
  [Nr] Name  Type Address   Offset
   Size  EntSize  Flags  Link  Info  Align
  [ 0]   NULL   
        0 0 0
  [ 1] .interp   PROGBITS 00400238  0238
   001c     A   0 0 1
  [ 2] .note.ABI-tag NOTE 00400254  0254
   0020     A   0 0 4
  [ 3] .note.gnu.build-i NOTE 00400274  0274
   0024     A   0 0 4
  [ 4] .hash HASH 00400298  0298
   0018  0004   A   6 0 8
  [ 5] .gnu.hash GNU_HASH 004002b0  02b0
   001c     A   6 0 8
  [ 6] .dynsym   DYNSYM   004002d0  02d0
...
  [25] .got.plt  PROGBITS 00601000  1000
   0020  0008  WA   0 0 8
  [26] .data PROGBITS 00601020  1020
   0010    WA   0 0 8
  [27] .bss  NOBITS   00601030  1030
   0008    WA   0 0 1
  [28] .comment  PROGBITS   1030
   0018  0001  MS   0 0 1
  [29] .debug_arangesPROGBITS   1050
   0130     0 0 16
  [30] .debug_info   PROGBITS   1180
   036d     0 0 1


> readelf -S a.out.debug 
There are 39 section headers, starting at offset 0x19e8:

Section Headers:
  [Nr] Name  Type Address   Offset
   Size  EntSize  Flags  Link  Info  Align
  [ 0]   NULL   
        0 0 0
  [ 1] .interp   NOBITS   00400238  0238
   001c     A   0 0 1
  [ 2] .note.ABI-tag NOTE 00400254  0254
   0020     A   0 0 4
  [ 3] .note.gnu.build-i NOTE 00400274  0274
   0024     A   0 0 4
  [ 4] .hash NOBITS   00400298  0298
   0018  0004   A   6 0 8
  [ 5] .gnu.hash NOBITS   004002b0  0298
   001c     A   6 0 8
  [ 6] .dynsym   NOBITS   004002d0  0298
...
  [25] .got.plt  NOBITS   00601000  0e00
   0020  0008  WA   0 0 8
  [26] .data NOBITS   00601020  0e00
   0010    WA   0 0 8
  [27] .bss  NOBITS   00601030  0e00
   0008    WA   0 0 1
  [28] .comment  PROGBITS   0298
   0018  0001  MS   0 0 1
  [29] .debug_arangesPROGBITS   02b0
   0130     0 0 16
  [30] .debug_info   PROGBITS   03e0
   036d     0 0 1

notice how section 28 and 29 start before section 27.

eu-strip gets this correct.

checked 2.27 and git HEAD.

-- 
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 gprof/21189] New: gprof doesn't work with code built with PIE

2017-02-21 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21189

Bug ID: 21189
   Summary: gprof doesn't work with code built with PIE
   Product: binutils
   Version: 2.28
Status: NEW
  Severity: normal
  Priority: P2
 Component: gprof
  Assignee: unassigned at sourceware dot org
  Reporter: doko at debian dot org
  Target Milestone: ---

[forwarded from https://bugs.debian.org/854704]

"""
Since --enabled-default-pie was enabled in Debian for GCC 6, gprof no longer
works. I run a simple program compiled with default flags and gprof's output is
empty.

$ cat infloop.c
int main() {
for(long i = 0; i < 10; i ++) {}
return 0;
}
$ gcc infloop.c -o infloop -pg
$ time ./infloop

real0m2.067s
user0m2.064s
sys 0m0.004s
$ gprof ./infloop | grep main
$

However, when I compile the same program with any earlier version of gcc, such
as gcc 5.4.1, or with the option -no-pie to disable PIE, it works.

$ gcc-5 infloop.c -o infloop -pg
$ rm gmon.out
$ time ./infloop

real0m2.041s
user0m2.036s
sys 0m0.000s
$ gprof ./infloop | grep main
101.41  2.06 2.06 main
$ gcc -no-pie infloop.c -o infloop -pg
$ rm gmon.out
$ time ./infloop

real0m2.019s
user0m2.016s
sys 0m0.000s
$ gprof ./infloop | grep main
101.41  2.03 2.03 main
$

This is the case for more complex programs too: gprof simply outputs nothing
other than the help-text. It looks like gcc is correctly generating the
gmon.out file, since it gets quite large and contains non-zero values.

Since GCC 6 moved to --enable-default-pie, all executables are of type DYN (not
EXEC), like shared libraries, and may be loaded at any base address. I suspect
this is breaking gprof's symbol lookup functionality. For instance, 0 is now a
valid address within the DYN ELF file. A good workaround for now is -no-pie,
but it would be great to get this fixed since Debian GCC now defaults to PIE.
"""

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