sc520 problems with objcopy
I've been porting to an sc520 based board and I've had several compiler and linker issues which I think I have solved. The problem now is that objcopy never finishes and uses all available memory. I have to kill the process otherwise it starts to try and use all virtual memory as well.
I did a system call trace, and from it you can see that it gets to a point where it is calling brk() and from this it never seems to end.
Has anyone else had this problem? Is it a problem caused by linker/compiler settings? Any clues would be appreciated!
root at gentoo u-boot-1.1.1 # make
... SNIP ...
UNDEF_SYM=`objdump -x lib_generic/libgeneric.a board/sc520_dsb/libsc520_dsb.a cpu/i386/libi386.a lib_i386/libi386.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a drivers/libdrivers.a drivers/sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a
common/libcommon.a |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
ld -Bstatic -T
/samba/development/40_Magellan_Standard_Software/MAL/boot/u-boot-1.1.1/board/sc520_dsb/u-boot.lds -Ttext 0x387c0000 $UNDEF_SYM cpu/i386/start.o cpu/i386/start16.o cpu/i386/reset.o \
--start-group lib_generic/libgeneric.a
board/sc520_dsb/libsc520_dsb.a cpu/i386/libi386.a lib_i386/libi386.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a net/libnet.a disk/libdisk.artc/librtc.a dtt/libdtt.a drivers/libdrivers.a drivers/sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a common/libcommon.a --no-warn-mismatch -L /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4 -lgcc --end-group \
-Map u-boot.map -o u-boot
objcopy --gap-fill=0xff -O srec u-boot u-boot.srec
... I press CTRL+C at this point to interrupt, otherwise all my memory gets used.
make: *** [u-boot.srec] Interrupt
root at gentoo u-boot-1.1.1 # objcopy --version
GNU objcopy 2.14.90.0.8 20040114
root at gentoo u-boot-1.1.1 # ll u-boot -rwxrwxr-x 1 root root 594727 Oct 6 12:04 u-boot
... I perform a system call trace here to see what is happening during objcopy
root at gentoo u-boot-1.1.1 # strace objcopy --gap-fill=0xff -O srec u-boot u-boot.srec
execve("/usr/bin/objcopy", ["objcopy", "--gap-fill=0xff", "-O", "srec", "u-boot", "u-boot.srec"], [/* 52 vars */]) = 0uname({sys="Linux", node="gentoo", ...}) = 0
brk(0) = 0x808b000open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000open("/etc/ld.so.cache", O_RDONLY) = 3fstat64(3, {st_mode=S_IFREG|0644, st_size=76539, ...}) = 0 mmap2(NULL, 76539, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40015000
close(3) = 0open("/usr/lib/libbfd-2.14.90.0.8.so", O_RDONLY) = 3read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\370"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=618708, ...}) = 0 mmap2(NULL, 634196, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40028000 mmap2(0x400b8000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x8f) = 0x400b8000mmap2(0x400bf000, 15700, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400bf000
close(3) = 0open("/lib/libdl.so.2", O_RDONLY) = 3read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\34\0\000"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=10964, ...}) = 0 mmap2(NULL, 8624, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400c3000 mmap2(0x400c5000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x2) = 0x400c5000
close(3) = 0open("/lib/libc.so.6", O_RDONLY) = 3read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200Y\1"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1174424, ...}) = 0 mmap2(NULL, 1104676, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400c6000 mmap2(0x401ce000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x107) = 0x401ce000mmap2(0x401d2000, 6948, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401d2000
close(3) = 0
munmap(0x40015000, 76539) = 0
open("/dev/urandom", O_RDONLY) = 3
read(3, "\316\324\316\262", 4) = 4
close(3) = 0
brk(0) = 0x808b000
brk(0x80ac000) = 0x80ac000
brk(0) = 0x80ac000
brk(0) = 0x80ac000stat64("u-boot", {st_mode=S_IFREG|0775, st_size=594727, ...}) = 0 stat64("u-boot", {st_mode=S_IFREG|0775, st_size=594727, ...}) = 0open("u-boot", O_RDONLY) = 3fstat64(3, {st_mode=S_IFREG|0775, st_size=594727, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40015000_llseek(3, 0, [0], SEEK_SET) = 0read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0\0\0|84"..., 4096) = 4096
_llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, 557056, [557056], SEEK_SET) = 0
read(3, "entoo Linux 3.3.4-r1, ssp-3.3.2-"..., 4096) = 4096 _llseek(3, 561152, [561152], SEEK_SET) = 0_llseek(3, 0, [0], SEEK_SET) = 0read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0\0\0|84"..., 4096) = 4096 stat64("u-boot.srec", {st_mode=S_IFREG|0664, st_size=0, ...}) = 0 open("u-boot.srec", O_RDWR|O_CREAT|O_TRUNC, 0666) = 4_llseek(3, 557056, [557056], SEEK_SET) = 0read(3, "entoo Linux 3.3.4-r1, ssp-3.3.2-"..., 4096) = 4096read(3, "\0\0\0\0\0\0\361\377=\5\0\0 \360\376\377\0\0\0\0\0\0\361"..., 16384) = 16384read(3, "\n\0\0\0\22\0\1\0\3;\0\0\324\214|8\372\0\0\0\22\0\1\0\v"..., 4096) = 4096
brk(0) = 0x80ac000
brk(0x80db000) = 0x80db000read(3, "urge_tx_ring\0rx_next\0rx_ring\0tx_"..., 12288) = 12288 read(3, "\0__u_boot_cmd_cp\0strspn\0NetSendP"..., 4096) = 807_llseek(3, 8192, [8192], SEEK_SET) = 0read(3, "\270\30\0\0\0\216\340\216\330\216\350\216\300\216\320\275"..., 81920) = 81920read(3, "\311\351\t\371\377\377\215e\364[^_\311\303U\211\345WVS"..., 4096) = 4096
brk(0) = 0x80db000 brk(0x8103000) = 0x8103000 _llseek(3, 94208, [94208], SEEK_SET) = 0
read(3, "Redirect to \0*** ERROR: `serveri"..., 16384) = 16384read(3, "h() routine too large (%d) %p - "..., 4096) = 4096_llseek(3, 114688, [114688], SEEK_SET) = 0read(3, "\0\0|8\0\0\2008\313\232}8\0\0@\0\223\f\0\0\224\f@\0\314"..., 4096) = 4096_llseek(3, 4096, [4096], SEEK_SET) = 0read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096 _llseek(3, 118784, [118784], SEEK_SET) = 0read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096 _llseek(3, 122880, [122880], SEEK_SET) = 0read(3, "\272\374\377f\270\313\360\r\200f\357\270\0\337\216\330"..., 4096) = 4096 _llseek(3, 126976, [126976], SEEK_SET) = 0_llseek(3, 126976, [126976], SEEK_SET) = 0read(3, "\1\0\0\0\0\0\260\3\\\3\0\0\1\0\0\0d\0\0\0\0\0|8\22\0\0"..., 8192) = 8192 read(3, "\275\1\0\0\0\0\0\0D\0`\1\301\1\0\0\0\0\0\0D\0a\1\304\1"..., 4096) = 4096 read(3, "!\0I\23/\v\0\0\t\17\0\v\vI\23\0\0\n\25\1\1\23\'\f\0\0\v"..., 28672) = 28672read(3, "8\n\0\0\16\26\0\3\10:\v;\vI\23\0\0\17\23\1\1\23\3\16\v"..., 4096) = 4096 mmap2(NULL, 286720, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x401d4000read(3, "Tu\7\0\0\0214\10\0\0\f\n\v1\6\307*\0\0\v!F\4\0\0\2#\0\6"..., 278528) = 278528read(3, "\207\2\0\0\3#\264\4\5\327O\0\0\2@\207\2\0\0\3#\200\5\005"..., 4096) = 4096munmap(0x401d4000, 286720) = 0read(3, "\34V\325)I,V2V\10\36r\253p\234\200\342\343\272\236\3\t"..., 45056) = 45056 read(3, "\270b7;\270\3\274\1c/\3\v\267\3uc\3\f9da\3u9\3\f9:\3\346"..., 4096) = 4096 _llseek(3, 503808, [503808], SEEK_SET) = 0read(3, "A\16\10\205\2B\r\5 \0\0\0\270\f\0\0\341=|8\227\0\0\0A\16"..., 16384) = 16384read(3, "\2B\r\5F\203\5\206\4\207\3].\10\0\0\34\0\0\0\264M\0\0\324"..., 4096) = 4096read(3, "\0__u_boot_cmd_chpart\0\0\0\0\0\256\1\0\0\2\0\331"..., 4096) = 4096 read(3, "\0\0flash_info\0\0\0\0\0p\0\0\0\2\0#>\3\0\207\17\0\0\217"..., 4096) = 4096 read(3, "\0\0p\0\0\0\206\0\0\0\0\0\0\0\0\0\0\0\301\0\0\0\315\0\0"..., 4096) = 4096 read(3, "ArpWaitPacketMAC\0NetOurHostName\0"..., 16384) = 16384 read(3, "pos\0data_in\0rtime_decompress\0com"..., 4096) = 4096read(3, "entoo Linux 3.3.4-r1, ssp-3.3.2-"..., 4096) = 4096
brk(0) = 0x8103000 brk(0x8125000) = 0x8125000 brk(0) = 0x8125000 brk(0x8147000) = 0x8147000 brk(0) = 0x8147000
... never ends ...
regards,
Aras Vaichas
Quoted 4 lines · Aras Vaichas
I've been porting to an sc520 based board and I've had several compiler and linker issues which I think I have solved. The problem now is that objcopy never finishes and uses all available memory. I have to kill the process otherwise it starts to try and use all virtual memory as well.
Looking at past posts, it looks like the sc520 port is in bad shape. I tried compiling sc520_spunk and sc520_cdp and they are missing so many files and have some so many linker problems (due to missing files and broken linker script) It looks like some PCI stuff must have disappeared along the way somewhere too ...
Quoted 1 line
objcopy --gap-fill=0xff -O srec u-boot u-boot.srec
I removed the --gap-fill=0xff and I was able to create an srec file. I think objcopy was spending all its time filling in 0xff ... I don't know if it works yet, but at least I was able to complete a make.
Perhaps the sc520_xxxx ports should be marked as "incomplete" or "broken"?
regards,
Aras