Commit 7b395232da84ae59bd32985bf944a0a9f417a543
Committed by
Tom Rini
1 parent
55db9ccae3
Exists in
master
and in
53 other branches
malloc: make malloc_bin_reloc static
On architectures where manual relocation is needed, the 'malloc_bin_reloc' function must be called after 'mem_malloc_init'. Make the 'malloc_bin_reloc' function static and call it directly from 'mem_malloc_init' instead of calling that from board_init_{r,f} functions of the affected architectures. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Cc: Wolfgang Denk <wd@denx.de> Cc: Andreas Bießmann <andreas.devel@gmail.com> Cc: Jason Jin <Jason.jin@freescale.com> Cc: Macpaul Lin <macpaul@andestech.com> Cc: Daniel Hellstrom <daniel@gaisler.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Showing 6 changed files with 5 additions and 6 deletions Side-by-side Diff
arch/avr32/lib/board.c
... | ... | @@ -286,7 +286,6 @@ |
286 | 286 | /* The malloc area is right below the monitor image in RAM */ |
287 | 287 | mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off - |
288 | 288 | CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN); |
289 | - malloc_bin_reloc(); | |
290 | 289 | dma_alloc_init(); |
291 | 290 | |
292 | 291 | enable_interrupts(); |
arch/m68k/lib/board.c
... | ... | @@ -449,7 +449,6 @@ |
449 | 449 | /* The Malloc area is immediately below the monitor copy in DRAM */ |
450 | 450 | mem_malloc_init (CONFIG_SYS_MONITOR_BASE + gd->reloc_off - |
451 | 451 | TOTAL_MALLOC_LEN, TOTAL_MALLOC_LEN); |
452 | - malloc_bin_reloc (); | |
453 | 452 | |
454 | 453 | #if !defined(CONFIG_SYS_NO_FLASH) |
455 | 454 | puts ("Flash: "); |
arch/nds32/lib/board.c
... | ... | @@ -320,7 +320,6 @@ |
320 | 320 | /* The Malloc area is immediately below the monitor copy in DRAM */ |
321 | 321 | malloc_start = dest_addr - TOTAL_MALLOC_LEN; |
322 | 322 | mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN); |
323 | - malloc_bin_reloc(); | |
324 | 323 | |
325 | 324 | #ifndef CONFIG_SYS_NO_FLASH |
326 | 325 | /* configure available FLASH banks */ |
arch/sparc/lib/board.c
... | ... | @@ -271,7 +271,6 @@ |
271 | 271 | /* The Malloc area is immediately below the monitor copy in RAM */ |
272 | 272 | mem_malloc_init(CONFIG_SYS_MALLOC_BASE, |
273 | 273 | CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE); |
274 | - malloc_bin_reloc(); | |
275 | 274 | |
276 | 275 | #if !defined(CONFIG_SYS_NO_FLASH) |
277 | 276 | puts("Flash: "); |
common/dlmalloc.c
... | ... | @@ -1485,7 +1485,7 @@ |
1485 | 1485 | }; |
1486 | 1486 | |
1487 | 1487 | #ifdef CONFIG_NEEDS_MANUAL_RELOC |
1488 | -void malloc_bin_reloc (void) | |
1488 | +static void malloc_bin_reloc(void) | |
1489 | 1489 | { |
1490 | 1490 | mbinptr *p = &av_[2]; |
1491 | 1491 | size_t i; |
... | ... | @@ -1493,6 +1493,8 @@ |
1493 | 1493 | for (i = 2; i < ARRAY_SIZE(av_); ++i, ++p) |
1494 | 1494 | *p = (mbinptr)((ulong)*p + gd->reloc_off); |
1495 | 1495 | } |
1496 | +#else | |
1497 | +static inline void malloc_bin_reloc(void) {} | |
1496 | 1498 | #endif |
1497 | 1499 | |
1498 | 1500 | ulong mem_malloc_start = 0; |
... | ... | @@ -1526,6 +1528,8 @@ |
1526 | 1528 | mem_malloc_brk = start; |
1527 | 1529 | |
1528 | 1530 | memset((void *)mem_malloc_start, 0, size); |
1531 | + | |
1532 | + malloc_bin_reloc(); | |
1529 | 1533 | } |
1530 | 1534 | |
1531 | 1535 | /* field-extraction macros */ |