Bug 18689

Summary: Building perf fails with ld: fatal error: No space left on device
Product: binutils Reporter: Markus Trippelsdorf <markus>
Component: goldAssignee: H.J. Lu <hjl.tools>
Status: RESOLVED FIXED    
Severity: normal CC: ian
Priority: P2    
Version: 2.26   
Target Milestone: 2.26   
Host: Target:
Build: Last reconfirmed:
Attachments: test binary

Description Markus Trippelsdorf 2015-07-16 21:06:36 UTC
Trying to build perf (ships with the linux kernel) fails:

For example:

markus@x4 perf %  gcc -Wp,-MD,arch/x86/util/.dwarf-regs.o.d,-MT,arch/x86/util/dwarf-regs.o  -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_PERF_REGS_SUPPORT -Werror -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 -fstack-protector-all -D_FORTIFY_SOURCE=2 -I/usr/src/linux/tools/perf/util/include -I/usr/src/linux/tools/perf/arch/x86/include -I/usr/src/linux/tools/include/ -I/usr/src/linux/arch/x86/include/uapi -I/usr/src/linux/arch/x86/include -I/usr/src/linux/include/uapi -I/usr/src/linux/include -I/usr/src/linux/tools/perf/util -I/usr/src/linux/tools/perf -I/usr/src/linux/tools/lib/ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP -DHAVE_LIBELF_SUPPORT -DHAVE_LIBELF_MMAP_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_DWARF_SUPPORT  -DHAVE_DWARF_UNWIND_SUPPORT -DNO_LIBUNWIND_DEBUG_FRAME -DHAVE_LIBUNWIND_SUPPORT  -DHAVE_LIBAUDIT_SUPPORT -I/usr/include/slang -DHAVE_SLANG_SUPPORT -DHAVE_GTK2_SUPPORT -DNO_LIBPERL -DHAVE_TIMERFD_SUPPORT -DHAVE_LIBBFD_SUPPORT -DHAVE_ZLIB_SUPPORT -DHAVE_LZMA_SUPPORT -DHAVE_BACKTRACE_SUPPORT -DHAVE_KVM_STAT_SUPPORT -DHAVE_AUXTRACE_SUPPORT -D"BUILD_STR(s)=#s"   -c -o arch/x86/util/dwarf-regs.o arch/x86/util/dwarf-regs.c

markus@x4 perf % ld -r -o foo.o arch/x86/util/dwarf-regs.o
markus@x4 perf % ld -r -o test foo.o
ld: fatal error: test: No space left on device
Comment 1 Markus Trippelsdorf 2015-07-16 21:07:05 UTC
Created attachment 8445 [details]
test binary
Comment 2 H.J. Lu 2015-07-16 22:14:44 UTC
A patch is posted at

https://sourceware.org/ml/binutils/2015-07/msg00143.html
Comment 3 H.J. Lu 2015-07-16 22:18:05 UTC
(In reply to H.J. Lu from comment #2)
> A patch is posted at
> 
> https://sourceware.org/ml/binutils/2015-07/msg00143.html

Please use this instead:

https://sourceware.org/ml/binutils/2015-07/msg00144.html
Comment 4 Markus Trippelsdorf 2015-07-17 11:40:04 UTC
Thanks for the quick fix.
Comment 5 H.J. Lu 2015-07-20 16:01:33 UTC
[hjl@gnu-6 pr18689]$ cat foo.c
/* Dummy file.  */
[hjl@gnu-6 pr18689]$ make
gcc -ggdb3 -Wa,--compress-debug-sections=zlib-gabi   -c -o foo.o foo.c
./ld.gold -r -o x.o foo.o
./ld -r -o y.o x.o
./ld: x.o: unable to initialize decompress status for section .debug_macro
./ld: x.o: unable to initialize decompress status for section .debug_macro
./ld: x.o: unable to initialize decompress status for section .debug_macro
./ld: x.o: unable to initialize decompress status for section .debug_macro
x.o: file not recognized: File format not recognized
Makefile:30: recipe for target 'y.o' failed
make: *** [y.o] Error 1
[hjl@gnu-6 pr18689]$
Comment 6 Sourceware Commits 2015-07-20 17:15:31 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit f54f5e31ce1270a1e9441348d6f2ea2426352478
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 20 10:14:26 2015 -0700

    Clear SHF_COMPRESSED flag bit from input to output
    
    For relocatable link, we should clear the SHF_COMPRESSED flag bit from
    input group section.
    
    	PR gold/18689
    	* layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
    	from input group section for relocatable link.
    	* testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
    	(check_DATA): Add pr18689.stdout.
    	(MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
    	(pr18689.stdout): New rule.
    	(pr18689a.o): Likewise.
    	(pr18689b.o): Likewise.
    	(pr18689.o): Likewise.
    	* testsuite/pr18689.c: New file.
    	* testsuite/pr18689.sh: Likewise.
    	* testsuite/Makefile.in: Regenerated.
Comment 7 H.J. Lu 2015-07-20 17:17:28 UTC
Fixed.