[coldfire-gnu-discuss] Coldfire uclinux problem

Dave Meador dave at meadorresearch.com
Wed Nov 12 18:24:22 UTC 2008


Hello Maxim,

Maxim Kuvyrkov wrote:
> Dave Meador wrote:
>> Hello,
>>
>> I tried to compile uclinux-dist-20080808 with 
>> uClinux-dist-20080808-20080922.patch applied and with 
>> Freescale,M5475EVB selected.  I am using version Sourcery G++ Lite 
>> 4.3-45 compiler.
>
> Does the distro compile without the patch?
Yes, it does.
>>
>> All files compile, but the linker fails with the following linker error:
>>
>>  LD      init/built-in.o
>>  LD      vmlinux
>
> What is the real command line for invoking the linker?  You may be 
> able to obtain it by passing something like V=1 or VERBOSE=1 to make; 
> e.g., 'make V=1'.
Here is the output of the linker command with V=1 :
  m68k-uclinux-ld   -o vmlinux -T arch/m68knommu/kernel/vmlinux.lds 
arch/m68knommu/platform/coldfire/head.o  init/built-in.o --start-group  
usr/built-in.o  arch/m68knommu/kernel/built-in.o  
arch/m68knommu/mm/built-in.o  
arch/m68knommu/platform/coldfire/built-in.o  
arch/m68knommu/platform/5407/built-in.o  kernel/built-in.o  
mm/built-in.o  fs/built-in.o  ipc/built-in.o  security/built-in.o  
crypto/built-in.o  block/built-in.o  lib/lib.a  
arch/m68knommu/lib/lib.a  lib/built-in.o   
arch/m68knommu/lib/built-in.o  drivers/built-in.o  sound/built-in.o  
net/built-in.o --end-group
/opt/crosstool/CodeSourcery/Sourcery_G++_Lite/bin/m68k-uclinux-ld.real: 
error: no memory region specified for loadable section `.text.unlikely'
make[1]: *** [vmlinux] Error 1
make[1]: Leaving directory `./uClinux-dist/linux-2.6.x'
make: *** [linux] Error 1
>> /opt/crosstool/CodeSourcery/Sourcery_G++_Lite/bin/m68k-uclinux-ld.real: 
>> error:
>> no memory region specified for loadable section `.text.unlikely'
>>
>> Any ideas on what might be wrong here and how I can get past this?
>
> The linker script [either explicit or implicit] does not have 
> instructions what to do with .text.unlikely section.  You probably 
> need to fix the linker script to handle the section; one way of doing 
> this is to handle it in the same manner as .text section.
I found that the .text.unlikely and .text.hot section seems to be 
related to -freorder-functions option.  I think this option may be 
triggered by the -O2 optimization flag. 

I updated the vmlinux.lds linker script to include the .text.hot and 
.text.unlikely and it compiled... but I have no idea if my additions are 
correct.

Original vmlinux.lds:
---
SECTIONS {
 .text : {
  _text = .;
  _stext = . ;
  *(.head.text)
  . = ALIGN(8); *(.text) *(.ref.text) *(.text.init.refok) 
*(.exit.text.refok)
---

Modified vmlinux.lds:
---
SECTIONS {
 .text : {
  _text = .;
  _stext = . ;
  *(.head.text)
  . = ALIGN(8); *(.text) *(.ref.text) *(.text.init.refok) 
*(.exit.text.refok)
+  . = ALIGN(8); *(.text.hot) *(.text.unlikely)
---

I am not a linker script guru, so if you could give me some insight as 
to what is happening and what should be correct in your opinion?  My 
very watered down understanding is that you would want to group often 
used functions (.text.hot) together which may allow performance benefits 
such as accessing fewer memory pages frequently.  And put the less 
frequently used functions in a different area, perhaps far away from the 
frequently used memory?

Thanks very much for your help,
Dave





More information about the coldfire-gnu-discuss mailing list