[Bug gold/13809] New: --print-icf-sections prints about folding empty sections

2012-03-05 Thread mh-sourceware at glandium dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13809

 Bug #: 13809
   Summary: --print-icf-sections prints about folding empty
sections
   Product: binutils
   Version: 2.22
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: mh-sourcew...@glandium.org
CC: ccout...@google.com
Classification: Unclassified


$  foo.c
$ gcc -o foo.so -shared foo.c -Wl,--icf=safe -Wl,--print-icf-sections
-ffunction-sections -fdata-sections
/usr/local/bin/ld: ICF Converged after 2 iteration(s)
/usr/local/bin/ld: ICF folding section '.text' in file
'/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o'into
'.text' in file '/tmp/ccrGpJnm.o'

-- 
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/12152] Many 64-bit Solaris/SPARC gcc -gstabs testcases fail to link

2012-03-05 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=12152

--- Comment #3 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot 
gnu.org 2012-03-05 16:02:27 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:r...@sourceware.org2012-03-05 16:02:20

Modified files:
bfd: ChangeLog elfxx-sparc.c 

Log message:
PR ld/12152
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Also ignore
overflows for R_SPARC_UA32 in .stab sections.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=srcr1=1.5620r2=1.5621
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-sparc.c.diff?cvsroot=srcr1=1.62r2=1.63

-- 
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/12152] Many 64-bit Solaris/SPARC gcc -gstabs testcases fail to link

2012-03-05 Thread ro at TechFak dot Uni-Bielefeld.DE
http://sourceware.org/bugzilla/show_bug.cgi?id=12152

Rainer Orth ro at TechFak dot Uni-Bielefeld.DE changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED
 AssignedTo|unassigned at sources dot   |ro at CeBiTec dot
   |redhat.com  |Uni-Bielefeld.DE

--- Comment #4 from Rainer Orth ro at TechFak dot Uni-Bielefeld.DE 2012-03-05 
16:03:59 UTC ---
Fixed for 2.23.

-- 
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/13809] --print-icf-sections prints about folding empty sections

2012-03-05 Thread ian at airs dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13809

Ian Lance Taylor ian at airs dot com changed:

   What|Removed |Added

 CC||ian at airs dot com,
   ||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 ld/13803] ld test-cases failing: arm-elf.exp erratum 760522 fix

2012-03-05 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13803

--- Comment #1 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot 
gnu.org 2012-03-05 17:21:48 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:h...@sourceware.org2012-03-05 17:21:42

Modified files:
ld/testsuite   : ChangeLog 
ld/testsuite/ld-arm: fix-arm1176-on.d fix-arm1176-off.d 

Log message:
PR ld/13803
* ld-arm/fix-arm1176-off.d, ld-arm/fix-arm1176-on.d: Regexpify
address of func_to_branch_to.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=srcr1=1.1497r2=1.1498
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-arm/fix-arm1176-on.d.diff?cvsroot=srcr1=1.1r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-arm/fix-arm1176-off.d.diff?cvsroot=srcr1=1.1r2=1.2

-- 
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/13811] New: --gc-sections --exclude-libs ALL leave undefined symbols referenced from garbage collected code

2012-03-05 Thread chemobejk at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13811

 Bug #: 13811
   Summary: --gc-sections --exclude-libs ALL leave undefined
symbols referenced from garbage collected code
   Product: binutils
   Version: 2.21
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: chemob...@gmail.com
Classification: Unclassified


Created attachment 6261
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6261
tar file with the example files for the reproducer

I first encountered this problem with older ARM toolchains, but with my test
case (see attachement) I have been able to reproduce it also with the x86
toolchain on Fedora 16. So I think this is a general problem in ld.

$ ld --version
GNU ld version 2.21.53.0.1-6.fc16 20110716

ld --gc-sections --exclude-libs ALL leaves undefined symbols in shared
libraries that are only referenced from garbage collected code.

In the example:

 - all code is compiled with GCC's -ffunction-sections -fdata-sections to
optimize it for ld's --gc-sections
 - libshared.c/libshared_funcA() references libstatic_funcA()
 - libstatic.c contains functions libstatic_funcA() and libstatic_funcB()
 - libstatic.c/libstatic_funcB() references libhidden_funcA()
 - libstatic.c ends up in libstatic.a
 - libshared.so is linked from libshared.o and libstatic.a using --gc-sections
--exclude-libs ALL

The linker drops the code for libstatic_funcB() during GC, but the resulting
shared library has an undefined symbol libhidden_funcA(). I.e. the library
references something which isn't used anywhere in the code. This makes the
shared library unusable, because you can't load it or link against it, unless
of course libhidden_funcA() is coming from somewhere else.


Running the example:

$ make
cc -fpic -ffunction-sections -fdata-sections   -c -o test.o test.c
cc -fpic -ffunction-sections -fdata-sections   -c -o libshared.o libshared.c
cc -fpic -ffunction-sections -fdata-sections   -c -o libstatic.o libstatic.c
ar rcs libstatic.a libstatic.o
ld -shared -Bsymbolic -nostdlib \
--gc-sections --exclude-libs ALL \
--no-undefined \
-o libshared.so -Map libshared.map \
libshared.o libstatic.a
cc -o test.exe test.o -L. -lshared
./libshared.so: undefined reference to `libhidden_funcA'
collect2: ld returned 1 exit status
make: *** [test.exe] Error 1

$ readelf --wide -s libshared.so | fgrep -e libstatic -e libhidden
 2:  0 NOTYPE  GLOBAL DEFAULT  UND libhidden_funcA
10:  0 FILELOCAL  DEFAULT  ABS libstatic.c
11: 023c 6 FUNCLOCAL  DEFAULT4 libstatic_funcA
14:  0 NOTYPE  GLOBAL DEFAULT  UND libhidden_funcA

$ cat libshared.map
Archive member included because of file (symbol)

libstatic.a(libstatic.o)  libshared.o (libstatic_funcA)

Discarded input sections
...
 .text.libstatic_funcB
0x0xb libstatic.a(libstatic.o)
...

$ fgrep libstatic_funcB libshared.map 
 .text.libstatic_funcB

$ objdump -d libshared.so

libshared.so: file format elf64-x86-64


Disassembly of section .text:

0231 libshared_funcA:
 231:   55  push   %rbp
 232:   48 89 e5mov%rsp,%rbp
 235:   e8 02 00 00 00  callq  23c libstatic_funcA
 23a:   5d  pop%rbp
 23b:   c3  retq   

023c libstatic_funcA:
 23c:   55  push   %rbp
 23d:   48 89 e5mov%rsp,%rbp
 240:   5d  pop%rbp
 241:   c3  retq   


So why does libhidden_funcA() end up in the symbol 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 ld/13812] New: Suboptimal default linker script cause internal error: out of range error

2012-03-05 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13812

 Bug #: 13812
   Summary: Suboptimal default linker script cause internal
error: out of range error
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: g...@gcc.gnu.org
CC: eric.wedding...@atmel.com
Classification: Unclassified
Target: avr


On big devices where stubs are generated to reach all targets of indirect
jumps, the following error might occur:

 warning: internal error: out of range error

Reason is the following part of the default linker script that
places .trampolines after .progmem:

/* For data that needs to reside in the lower 64k of progmem.  */
*(.progmem.gcc*)
*(.progmem*)
. = ALIGN(2);
 __trampolines_start = . ;
/* The jump trampolines for the 16-bit limited relocs will reside here.  */
*(.trampolines)
*(.trampolines*)
 __trampolines_end = . ;

Thus, if there is lot of data in the .progmem.data section (which is avr-gcc's
default section for data located in flash), the .trampolines section is located
outside the first 64 Ki word segment.

There are two issues:

1) The error message is not helpful at all. It should mention that something
   goes wrong with the .trampolines or gs() modifiers or stubs generation.

2) The error could be avoided by placing .trampolines prior to .progmem like
so:

/* For data that needs to reside in the lower 64k of progmem.  */
*(.progmem.gcc*)
. = ALIGN(2);
 __trampolines_start = . ;
/* The jump trampolines for the 16-bit limited relocs will reside here.  */
*(.trampolines)
*(.trampolines*)
 __trampolines_end = . ;
*(.progmem*)

The .progmem.gcc* section is used for jump dispatch tables (e.g.
.progmem.gcc_sw_table) and must be located in lower 64 KiB

-- 
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/13812] Suboptimal default linker script cause internal error: out of range error

2012-03-05 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13812

--- Comment #1 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-03-05 
21:36:52 UTC ---
Created attachment 6262
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6262
stubc.c: Simplified C test case

Compile with

avr-gcc -mmcu=atmega2560 stubs.c -S -Os

-- 
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/13812] Suboptimal default linker script cause internal error: out of range error

2012-03-05 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13812

--- Comment #2 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-03-05 
21:48:30 UTC ---
Created attachment 6263
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6263
stubc.s: Assembler file

Assemble/Link with:

avr-as -mmcu=atmega2560 stubs.s -o stubs.o
avr-ld -mavr6 stubs.o

or at your option

avr-gcc -mmcu=atmega2560 stubs.s

Error message:

stubs.o: In function `main':
stubs.c:(.text.startup+0x0): warning: internal error: out of range error
stubs.c:(.text.startup+0x2): warning: internal error: out of range error

Relevant part of the map file:

.text   0x0x2720e
 *(.vectors)
 .vectors   0x   0xe4
e:/winavr/4.7.0-3/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/crtm2560.o
0x__vector_default
0x__vectors
 *(.vectors)
 *(.progmem.gcc*)
 *(.progmem*)
 .progmem.data  0x00e40x27100 stubs.o
0x00e4array4
0x7de4array3
0xfae4array2
0x000177e4array1
0x0001f4e4array0
0x000271e4. = ALIGN (0x2)
0x000271e4__trampolines_start = .
 *(.trampolines)
 .trampolines   0x000271e40x4 linker stubs
 *(.trampolines*)
0x000271e8__trampolines_end = .
 *(.jumptables)

-- 
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/13803] ld test-cases failing: arm-elf.exp erratum 760522 fix

2012-03-05 Thread hp at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13803

Hans-Peter Nilsson hp at sourceware dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #2 from Hans-Peter Nilsson hp at sourceware dot org 2012-03-05 
22:40:10 UTC ---
fixed

-- 
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/13683] usage tracking by --gc-sections ignores a --defsym mapping

2012-03-05 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13683

--- Comment #13 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot 
gnu.org 2012-03-05 23:09:15 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:amo...@sourceware.org2012-03-05 23:09:11

Modified files:
ld/testsuite   : ChangeLog 
ld/testsuite/ld-gc: pr13683.d 

Log message:
PR ld/13683
* ld-gc/pr13683.d: Allow non-zero top address digit.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=srcr1=1.1498r2=1.1499
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-gc/pr13683.d.diff?cvsroot=srcr1=1.1r2=1.2

-- 
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/13802] ld testsuite failure: comm-data.exp Common symbol override test; referred common symbol not UNDefined

2012-03-05 Thread hp at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13802

--- Comment #1 from Hans-Peter Nilsson hp at sourceware dot org 2012-03-05 
23:37:58 UTC ---
Same behavior seen in GNU ld 2.18.50.20080423 from CVS at the implied date so
this is at least not a recent regression.

N.B. the test-case assembly file got a linker warning Warning:
tmpdir/comm-data2.o: Unknown EABI object attribute 44 unless not re-assembled
with a contemporary assembler.  Just mentioned for the record; I'm assuming
this is to be expected between the old and the new tools as apparent from a
readelf -a diff between old and new output):

--- comm-data2.o.old.txtTue Mar  6 00:26:42 2012
+++ comm-data2.o.txtTue Mar  6 00:30:44 2012
@@ -10,8 +10,8 @@ ELF Header:
   Version:   0x1
   Entry point address:   0x0
   Start of program headers:  0 (bytes into file)
-  Start of section headers:  172 (bytes into file)
-  Flags: 0x400, Version4 EABI
+  Start of section headers:  180 (bytes into file)
+  Flags: 0x500, Version5 EABI
   Size of this header:   52 (bytes)
   Size of program headers:   0 (bytes)
   Number of program headers: 0

and:

@@ -62,3 +62,6 @@ Symbol table '.symtab' contains 10 entri
 No version information found in this file.
 Attribute Section: aeabi
 File Attributes
+  Tag_ARM_ISA_use: Yes
+  Tag_THUMB_ISA_use: Thumb-1
+  Tag_DIV_use: Not allowed

-- 
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/13811] --gc-sections --exclude-libs ALL leave undefined symbols referenced from garbage collected code

2012-03-05 Thread amodra at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13811

Alan Modra amodra at gmail dot com changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #1 from Alan Modra amodra at gmail dot com 2012-03-06 05:15:00 
UTC ---
Please try current mainline binutils.  I believe this has been fixed.

-- 
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/13811] --gc-sections --exclude-libs ALL leave undefined symbols referenced from garbage collected code

2012-03-05 Thread chemobejk at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13811

Stefan Becker chemobejk at gmail dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #2 from Stefan Becker chemobejk at gmail dot com 2012-03-06 
06:54:45 UTC ---
Thanks for the information. I tried:

 2.22:same issue
 2.22.52: works correctly

Closing.

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