mem.o:(.data+0x14): undefined reference to `_malloc' with 7D, but not 5D3

Started by Thomas Worth, September 19, 2013, 02:58:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thomas Worth

Up until a few days ago, I could compile ML for the 7D without a problem. I can't anymore, although compilation still works fine for 5D3 and other cameras (I didn't try all of them). Here's what I get when I try to compile "7D":

dietlibc.a(vsscanf.o): In function `vsscanf':
vsscanf.c:(.text+0x5c): warning: warning: the scanf functions add several kilobytes of bloat.
dietlibc.a(sprintf.o): In function `sprintf':
sprintf.c:(.text+0x14): warning: warning: Avoid *sprintf; use *snprintf. It is more secure.
mem.o:(.data+0x14): undefined reference to `_malloc'
mem.o:(.data+0x18): undefined reference to `_free'
mem.o:(.data+0x5c): undefined reference to `_AllocateMemory'
mem.o:(.data+0x60): undefined reference to `_FreeMemory'
mem.o:(.data+0x64): undefined reference to `_alloc_dma_memory'
mem.o:(.data+0x68): undefined reference to `_free_dma_memory'
collect2: error: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make: *** [7D] Error 2


I get the error on both Mac and Linux with my GCC 4.8.1 toolchain. Again, this was working fine a few days ago. Here's what I get when I compile "5D3":

dietlibc.a(vsscanf.o): In function `vsscanf':
vsscanf.c:(.text+0x5c): warning: warning: the scanf functions add several kilobytes of bloat.
dietlibc.a(sprintf.o): In function `sprintf':
sprintf.c:(.text+0x14): warning: warning: Avoid *sprintf; use *snprintf. It is more secure.
[ OBJCOPY  ]   magiclantern.bin
[ STAT     ]   magiclantern.bin
magiclantern.bin: 437384 bytes
[ CC       ]   reboot.o
[ LD       ]   autoexec

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x06ad80 0x000d4180 0x000d4180 0x00008 0x00008 R   0x4
  LOAD           0x000100 0x00069500 0x00069500 0x6ac88 0x7e87c RWE 0x100
[ OBJCOPY  ]   autoexec.bin
[ STAT     ]   autoexec.bin
autoexec.bin: 438016 bytes
[ SYMBOLS  ]   magiclantern.sym
[ CP       ]   5D3_113.sym


It compiles okay. What gives?

mk11174

Quote from: Thomas Worth on September 19, 2013, 02:58:03 AM
Up until a few days ago, I could compile ML for the 7D without a problem. I can't anymore, although compilation still works fine for 5D3 and other cameras (I didn't try all of them). Here's what I get when I try to compile "7D":

dietlibc.a(vsscanf.o): In function `vsscanf':
vsscanf.c:(.text+0x5c): warning: warning: the scanf functions add several kilobytes of bloat.
dietlibc.a(sprintf.o): In function `sprintf':
sprintf.c:(.text+0x14): warning: warning: Avoid *sprintf; use *snprintf. It is more secure.
mem.o:(.data+0x14): undefined reference to `_malloc'
mem.o:(.data+0x18): undefined reference to `_free'
mem.o:(.data+0x5c): undefined reference to `_AllocateMemory'
mem.o:(.data+0x60): undefined reference to `_FreeMemory'
mem.o:(.data+0x64): undefined reference to `_alloc_dma_memory'
mem.o:(.data+0x68): undefined reference to `_free_dma_memory'
collect2: error: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make: *** [7D] Error 2


http://www.magiclantern.fm/forum/index.php?topic=8358.msg76717#msg76717

you can use one of the other cam sources as a ref to know what you need to change like this one
https://bitbucket.org/hudson/magic-lantern/commits/aa1fa6ecbab0a6e973f934c578ed5fb997346650
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Thomas Worth

Excellent! Got it working. :D Thanks!

For others who encounter this problem: the solution is to change the entry points in /platform/7D.203/stubs.S to match the undefined references, e.g:

From:
NSTUB(0xff0162f0, malloc)

To:
NSTUB(0xff0162f0, _malloc)

Audionut