开发者

Error in binutils make for cross compilation

I am trying to compile binutils to set up GNU toolchain for cross compiling for ARM on linux x86 architecture.

For this, I downloaded the GNU toolc开发者_JS百科hain from : http://lejosrt.org/tuto/install-gnu-arm-toolchain-under-linux

This requires a script to be run to install and compile everything. However, on running the script, following error occurs:

make[2]: Entering directory /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty' rm -f ./libiberty.a pic/./libiberty.a ar rc ./libiberty.a \ ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./crc32.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o ./strsignal.o ./unlink-if-ordinary.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o

*** buffer overflow detected ***: ar terminated ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0x40117df0] /lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0x40116cca] /lib/i386-linux-gnu/libc.so.6(+0xe43c8)[0x401163c8] /lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x95)[0x4009b7e5] /lib/i386-linux-gnu/libc.so.6(_IO_padn+0xc8)[0x4008f598] /lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x1cd5)[0x40070e35] /lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xad)[0x4011647d] /lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2d)[0x401163bd] ar[0x804ec04] ar[0x8050d38] ar[0x80585c2] ar[0x804b452] ar[0x804c3fd] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x40048e37] ar[0x80494c1] ======= Memory map: ======== 08048000-080b5000 r-xp 00000000 08:01 3940915 /usr/local/bin/ar 080b5000-080b6000 r--p 0006c000 08:01 3940915 /usr/local/bin/ar 080b6000-080b7000 rw-p 0006d000 08:01 3940915 /usr/local/bin/ar 080b7000-080bb000 rw-p 00000000 00:00 0 08efe000-08f9d000 rw-p 00000000 00:00 0 [heap] 40000000-4001c000 r-xp 00000000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001c000-4001d000 r--p 0001b000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001d000-4001e000 rw-p 0001c000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001e000-4001f000 r-xp 00000000 00:00 0 [vdso] 4001f000-40021000 rw-p 00000000 00:00 0 40021000-40022000 r--p 0065c000 08:01 3544340 /usr/lib/locale/locale-archive 40032000-4018c000 r-xp 00000000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018c000-4018d000 ---p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018d000-4018f000 r--p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018f000-40190000 rw-p 0015c000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 40190000-40195000 rw-p 00000000 00:00 0 40195000-40395000 r--p 00000000 08:01 3544340 /usr/lib/locale/locale-archive 403a6000-403c0000 r-xp 00000000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 403c0000-403c1000 r--p 00019000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 403c1000-403c2000 rw-p 0001a000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 bff19000-bff3b000 rw-p 00000000 00:00 0 [stack] make[2]: *** [libiberty.a] Aborted make[2]: *** Deleting filelibiberty.a' make[2]: Leaving directory /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty' make[1]: *** [all-libiberty] Error 2 make[1]: Leaving directory/home/GNU_Toolchain/src/binutils-2.20.51.0.1' make: * [all] Error 2

I tried upgrading binutils package but in vain.

Any ideas? Thanks in advance.


If you want to just build it and ignore potential problems, put -D_FORTIFY_SOURCE=1 in with your CFLAGS. Since you're using make, it would look something like:

make CFLAGS="«other CFLAGS» -D_FORTIFY_SOURCE=1" «...»

Depending on your project, you could even supply this as a flag to the configure script.

When you build, you'll get a bunch of warnings about redefining this macro, but that's expected.

So what does this flag do? I'm no expert, but it's basically a new feature in recent versions of gcc/glibc that attempts to detect buffer overflows. The default level is "2" (AFAIK), which actually imposes some extra limits above and beyond what the standards dictate. Level "1" is a little less strict.

If you're pedantic, you might like to investigate exactly why your compiler is detecting a buffer overflow. It might be, for example, a call to snprintf where someone's forgotten about the NUL termination behaviour.

(Although: before you go to the trouble, it's quite likely that it's been patched by someone in the upstream project and the fix hasn't trickled through to whatever project you're obtaining this from, so I'd ask the project maintainers about it first.)

For more information, see this RedHat binutils mailing list post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜