[Bug gold/13364] New: ICF may not be as thorough as one would expect

2011-10-31 Thread mh-sourceware at glandium dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13364

 Bug #: 13364
   Summary: ICF may not be as thorough as one would expect
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: mh-sourcew...@glandium.org
CC: ccout...@google.com
Classification: Unclassified


When linking Mozilla's libxul.so with GNU gold (GNU Binutils 2.22.51.20111010)
1.11 on ARM, with code built as Thumb-2, with either --icf=safe or --icf=all, a
lot of functions one would expect to be folded aren't.

I figured this when looking what 2 bytes long functions content could be, and
it turns out a lot (if not all) are just doing "bx lr", the ARM/Thumb
equivalent to "ret". But not all the functions doing so are folded:

$ objdump -t libxul.so | awk '$3=="F" && $5=="0002" {print $1}'| sort |
uniq -c | sort -n
  1 00390fc5
  1 008545e9
  1 0085463d
  1 00854655
  1 0085467d
  1 0085c109
  1 0093948d
  1 00939cd1
  1 0093be95
  1 009498e9
  1 0095ca4d
  1 0095d79d
  1 0095d7dd
  1 00969ed9
  1 0096dffd
  1 00992691
  1 009b90c9
  1 009b90cd
  1 009e6781
  1 009e9ced
  1 009f8649
  1 00a18535
  1 00a40001
  1 00a5e30d
  1 00a60f79
  1 00a60f7d
  1 00a66f35
  1 00a680cd
  1 00ab97f5
  1 00ac57b1
  1 00ac57b5
  1 00aed3dd
  1 00aed3e1
  1 00afd821
  1 00afd825
  1 00b03575
  1 00b03579
  1 00b0357d
  1 00b03581
  1 00b089ad
  1 00b089b1
  2 003102d5
  2 00854545
  2 00854611
  2 0085b105
  2 0096bed9
  2 009d9129
  2 00a05855
  2 00afd81d
  3 003a6b77
  3 00832181
  3 00854505
  4 00296963
 41 00892571
721 001e98a5
(this list is with --icf=all, the --icf=safe list is longer)

Corresponding disassembly:
00390fc4 <_ZN14nsMenuBarFrame19LockMenuUntilClosedEb>:
  390fc4:   4770bx  lr
008545e8 <_ZN7mozilla6layers29BasicShadowableContainerLayer7AsLayerEv>:
  8545e8:   4770bx  lr
0085463c <_ZN7mozilla6layers25BasicShadowableImageLayer7AsLayerEv>:
  85463c:   4770bx  lr
00854654 <_ZN7mozilla6layers25BasicShadowableColorLayer7AsLayerEv>:
  854654:   4770bx  lr
0085467c <_ZN7mozilla6layers26BasicShadowableCanvasLayer7AsLayerEv>:
  85467c:   4770bx  lr
0085c108 <_ZN7mozilla6layers17ContainerLayerOGL8GetLayerEv>:
  85c108:   4770bx  lr
00296962 <_ZN13nsGridLayout216CastToGridLayoutEv>:
  296962:   4770bx  lr
001e98a4 :
  1e98a4:   4770bx  lr
etc.

A few disassemble to something like:
0093948c :
  93948c:   4770bx  lr
  93948e:   bf00nop

but still have a size of 2 in the symbols table.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13365] New: "Fold" functions that only jump to some other one

2011-10-31 Thread mh-sourceware at glandium dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13365

 Bug #: 13365
   Summary: "Fold" functions that only jump to some other one
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: mh-sourcew...@glandium.org
CC: ccout...@google.com
Classification: Unclassified


There can be plenty of reasons some code may end up looking like:
foo:
   jmp bar

In such cases, it would be interesting for the linker to just declare foo as an
alias of bar.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13366] New: Allow to "pack" some functions together

2011-10-31 Thread mh-sourceware at glandium dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13366

 Bug #: 13366
   Summary: Allow to "pack" some functions together
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: mh-sourcew...@glandium.org
CC: ccout...@google.com
Classification: Unclassified


In some cases, a function can look like:
foo:
   various stuff
   jmp bar

In cases where it makes sense, and where foo is the only function calling bar
in such a way, the linker could just place bar after foo and get rid of the
jump.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13364] ICF may not be as thorough as one would expect

2011-10-31 Thread ian at airs dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13364

Ian Lance Taylor  changed:

   What|Removed |Added

 CC||tmsriram at google dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13364] ICF may not be as thorough as one would expect

2011-10-31 Thread tmsriram at google dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13364

--- Comment #1 from Sriraman Tallam  2011-10-31 
17:50:37 UTC ---
Hi Mike,

   Can you give me instructions to build this or better, a reduced test case,
for me to debug.

Thanks,
-Sri.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13364] ICF may not be as thorough as one would expect

2011-10-31 Thread mh-sourceware at glandium dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13364

--- Comment #2 from Mike Hommey  2011-10-31 
18:23:26 UTC ---
I'll try to see if I can reduce the testcase.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13362] internal error in value_from_output_section, at ../../gold/reloc.cc:1549 on armel

2011-10-31 Thread jrnieder at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13362

Jonathan Nieder  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
Version|2.22|2.23 (HEAD)
 Resolution|DUPLICATE   |

--- Comment #3 from Jonathan Nieder  2011-10-31 
19:51:09 UTC ---
Hi again,

Quick update now that I have (remote) access to some hardware to test on
(thanks, Timo!):

Testing yesterday's HEAD (commit 5625fcaf, daily update, 2011-10-30), I get the
following result:

 $ make check
[...]
 (cd gcctestdir2 && ln -s ../ld1 ld)
 g++ -W -Wall-Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-frandom-seed=ld2 -g -O2 -Bgcctestdir2/  -o ld2 main.o i386.o x86_64.o sparc.o
powerpc.o arm.o arm-reloc-property.o libgold.a ../libiberty/libiberty.a -lz 
 gcctestdir1/ld -o libgold-1-r.o -r --whole-archive libgold.a
 make[4]: *** [libgold-1-r.o] Bus error
 make[4]: *** Deleting file `libgold-1-r.o'
 make[4]: Leaving directory `/home/jrn/src/binutils/gold'
 make[3]: *** [check-am] Error 2
 make[3]: Leaving directory `/home/jrn/src/binutils/gold'
 make[2]: *** [check-recursive] Error 1
 make[2]: Leaving directory `/home/jrn/src/binutils/gold'
 make[1]: *** [check-gold] Error 2
 make[1]: Leaving directory `/home/jrn/src/binutils'
 make: *** [do-check] Error 2

So I'm taking the liberty of reopening the bug. If I am missing something,
please feel free to let me know.

Thanks for gold, of course.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13362] internal error in value_from_output_section, at ../../gold/reloc.cc:1549 on armel

2011-10-31 Thread dougkwan at google dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13362

Doug Kwan  changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED

--- Comment #4 from Doug Kwan  2011-10-31 20:20:43 
UTC ---
I am looking at it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/11539] ld --gc-sections should work for PE-COFF on MinGW

2011-10-31 Thread xunxun1982 at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=11539

--- Comment #7 from xunxun  2011-10-31 21:02:31 
UTC ---
I try to keep eh_frame section, then the dll build can work (I test it in
wxWidgets 2.8.12 Release Mono Unicode Dll).
So we should find some methods to keep some sections of eh_frame.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13359] gold internal error in relocate_tls, at gold/x86_64.cc:3187

2011-10-31 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13359

--- Comment #2 from cvs-commit at gcc dot gnu.org  2011-10-31 22:33:11 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:ccout...@sourceware.org2011-10-31 22:33:05

Modified files:
gold   : ChangeLog i386.cc x86_64.cc 

Log message:
PR gold/13359
* i386.cc (Target_i386::Relocate::relocate_tls): Remove
unnecessary assertion.
* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.845&r2=1.846
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/i386.cc.diff?cvsroot=src&r1=1.141&r2=1.142
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/x86_64.cc.diff?cvsroot=src&r1=1.140&r2=1.141

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13359] gold internal error in relocate_tls, at gold/x86_64.cc:3187

2011-10-31 Thread ccoutant at google dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13359

Cary Coutant  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #3 from Cary Coutant  2011-10-31 
22:37:35 UTC ---
Fixed on trunk.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13023] gold misinterprets dot assignments in sections

2011-10-31 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13023

--- Comment #5 from cvs-commit at gcc dot gnu.org  2011-10-31 22:51:07 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:ccout...@sourceware.org2011-10-31 22:51:03

Modified files:
gold   : ChangeLog expression.cc script-sections.cc 
 script.cc script.h 
gold/testsuite : script_test_2.t 

Log message:
PR gold/13023
* expression.cc (Expression::eval_with_dot): Add
is_section_dot_assignment parameter.
(Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
absolute and assigning to dot within a section.
* script-sections.cc
(Output_section_element_assignment::set_section_addresses): Pass
dot_section to set_if_absolute.
(Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
as is_section_dot_assignment flag to eval_with_dot.
(Output_section_element_dot_assignment::set_section_addresses):
Likewise.
* script.cc (Symbol_assignment::set_if_absolute): Add dot_section
parameter.  Also set value if relative to dot_section; set the
symbol's output_section.
* script.h (Expression::eval_with_dot): Add is_section_dot_assignment
parameter.  Adjust all callers.
(Expression::eval_maybe_dot): Likewise.
(Symbol_assignment::set_if_absolute): Add dot_section parameter.
Adjust all callers.
* testsuite/script_test_2.t: Test assignment of an absolute value
to dot within an output section element.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.847&r2=1.848
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/expression.cc.diff?cvsroot=src&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/script-sections.cc.diff?cvsroot=src&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/script.cc.diff?cvsroot=src&r1=1.84&r2=1.85
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/script.h.diff?cvsroot=src&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/script_test_2.t.diff?cvsroot=src&r1=1.3&r2=1.4

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/13023] gold misinterprets dot assignments in sections

2011-10-31 Thread ccoutant at google dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13023

Cary Coutant  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #6 from Cary Coutant  2011-10-31 
23:15:20 UTC ---
Fixed in trunk.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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