[okl4-developer] Elfweaver / Linker problem with arm926 on okl4_2.1

Matthew Warton mwarton at ok-labs.com
Sat Apr 19 16:11:23 EST 2008


Hi Lukas,

Elfadorn is somewhat sensitive to the version of the linker you are  
using.  Since the default system does not use the functionality of  
ElfAdorn, the following patch may alleviate your problem by turning  
some of elfadorn's functionality off by default.

Let me know how it goes.

Cheers,
Matthew Warton

--- a/tools/toolchains.py       Tue Apr 15 08:48:49 2008 +1000
+++ b/tools/toolchains.py       Sat Apr 19 16:06:38 2008 +1000
@@ -105,7 +105,7 @@ class toolchain:
          # Setup linker
          self.dict["_LINK_COM_FLAGS"] = []
          self.dict["UNADORNED_LINKCOM"] = "$LINK $_LINK_COM_FLAGS  
$LINK_PLAT_FLAGS $_LINKADDRESS $_LINKSCRIPTS $LINKFLAGS $CRTOBJECT  
$SOURCES $_LIBFLAGS -o $TARGET"
-        self.dict["LINKCOM"] = "$ELFADORN -s -o $TARGET  
$ELFADORN_FLAGS   -- $UNADORNED_LINKCOM"
+        self.dict["LINKCOM"] = "$ELFADORN -o $TARGET  
$ELFADORN_FLAGS   -- $UNADORNED_LINKCOM"

          self.dict["LINK_PLAT_FLAGS"] = "${_platform(TOOLTYPE,  
'link_flags')}"


On 18/04/2008, at 5:59 PM, Lukas HANEL wrote:

> Hi
>
> When porting to the 2.1 release, after solving the above problem and
> some missing includes(see end) I run into problems with Elfweaver /
> Linker. I have no initial idea how to solve this problem and am  
> glad to
> get any idea. See the following output.
>
> Command to build l4test
> ~/okl4_2.1$ ./tools/build.py machine=nhk15 project=l4test -- 
> debug=presub
> []
> ~/okl4_2.1$ rm build/pistachio/bin/kernel
> ~/okl4_2.1$ ./tools/build.py machine=nhk15 project=l4test -- 
> debug=presub
> scons: Reading SConscript files ...
> architecture arm is not yet supported by libcompat.
> architecture arm is not yet supported by libcompat.
> scons: done reading SConscript files.
> scons: Building targets ...
> [LINK] build/pistachio/bin/kernel
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.text' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.glue_7' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.glue_7t' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.rodata' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.kdebug' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.init' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.roinit' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.data' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.got' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.got.plt' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.kdebug-data' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.bss' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.kspace' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.traps' not in segment
> arm-linux-ld: build/pistachio/bin/kernel: warning: allocated section
> `.utcb_page' not in segment
> Building build/images/image.elf with action:
>   tools/pyelf/elfweaver --traceback merge -o$TARGET $SOURCE
> [ELF ] build/images/image.elf
> Could not find address f001f844 in Image
> An error occurred: None
> Now printing a traceback.
>
> Traceback (most recent call last):
>   File "tools/pyelf/elfweaver", line 74, in ?
>     main(sys.argv)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/main.py", line 94,  
> in main
>     commands[args[1]](args[2:])
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/merge.py", line  
> 187, in
> merge_cmd
>     merge(spec_file, options)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/merge.py", line  
> 119, in
> merge
>     namespace, image, machine, pools, bootinfo)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/merge.py", line 95, in
> collect_image_objects
>     collect_kernel_element(parsed, kernel_heap_size, namespace, image,
> machine, pools)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/kernel_xml.py", line
> 190, in collect_kernel_element
>     dynamic_attrs.size = max_threads * get_tcb_size(elf, image)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/kernel_xml.py", line
> 118, in get_tcb_size
>     return image.get_value(addr, size, elf.endianess)
>   File "/home/lukas/okl4_2.1/tools/pyelf/weaver/image.py", line  
> 887, in
> get_value
>     raise "can't find symbol"
> can't find symbol
>
> Building build/images/image.sim with action:
>   tools/pyelf/elfweaver modify -o$TARGET $SOURCE --physical_entry
> [ELF ] build/images/image.sim
> An error occurred: [Errno 2] No such file or directory:
> 'build/images/image.elf'
> Building build/images/image.boot with action:
>   tools/pyelf/elfweaver modify -o$TARGET $SOURCE --physical_entry -- 
> physical
> [ELF ] build/images/image.boot
> An error occurred: [Errno 2] No such file or directory:
> 'build/images/image.elf'
> scons: done building targets.
>
> ---------------------------------------------------------------------- 
> --
> To know what the compiler is realy doing it is a big aid to change the
> scons toolchain informational output from the [CPP ] $TARGET to [CPP ]
> $COMMAND. However, I did not found a way to achieve the same thing for
> the Linker. Can you give me a hint?
>
> okl4_2.1/tools/toolchains.py
> class toolchain:
>         self.dict["CXXCOMSTR"] = "[CXX ] $CXXCOM"
> #        self.dict["CXXCOMSTR"] = "[CXX ] $TARGET"
>
> thanks,
> Lukas
>
> ---------------------------------------------------------------------- 
> --
> Needed changes to arch/arm/pistachio/cpu/arm926ejs:
>
> ~/okl4_2.1$ diff -Naur arch/arm/pistachio/
> ../okl4_2.1original/arch/arm/pistachio/
>
> diff -Naur arch/arm/pistachio/cpu/arm926ejs/include/cache.h
> ../okl4_2.1original/arch/arm/pistachio/cpu/arm926ejs/include/cache.h
> --- arch/arm/pistachio/cpu/arm926ejs/include/cache.h    2008-04-17
> 17:10:46.000000000 +0200
> +++
> ../okl4_2.1original/arch/arm/pistachio/cpu/arm926ejs/include/cache.h
> 2008-04-15 03:24:28.000000000 +0200
> @@ -65,11 +65,10 @@
>  #ifndef __ARCH__ARM__ARM926EJ_CACHE_H_
>  #define __ARCH__ARM__ARM926EJ_CACHE_H_
>
> -#include <kernel/debug.h>
> -#include <kernel/cpu/syscon.h>
> -#include <kernel/cache.h>
> -#include <kernel/plat/platform.h> /* Get cache size */
> -#include <kernel/arch/asm.h>
> +#include <debug.h>
> +#include <cpu/syscon.h>
> +#include <cache.h>
> +#include <plat/platform.h> /* Get cache size */
>
>  /* Write-through mode on arm926 */
>  #define CPU_WRITETHROUGH        2
> diff -Naur arch/arm/pistachio/cpu/arm926ejs/include/cpu.h
> ../okl4_2.1original/arch/arm/pistachio/cpu/arm926ejs/include/cpu.h
> --- arch/arm/pistachio/cpu/arm926ejs/include/cpu.h      2008-04-17
> 17:13:03.000000000 +0200
> +++ ../okl4_2.1original/arch/arm/pistachio/cpu/arm926ejs/include/cpu.h
> 2008-04-15 03:24:28.000000000 +0200
> @@ -65,8 +65,6 @@
>  #ifndef __ARCH__ARM__ARM926EJ__CPU_H_
>  #define __ARCH__ARM__ARM926EJ__CPU_H_
>
> -#define IODEVICE_VADDR          IO_AREA0_VADDR
> -
>  #include <kernel/arch/asm.h>
>  class arm_cpu
>  {
> @@ -97,7 +95,7 @@
>
>      static inline void sleep(void)
>      {
> -        int zero = 0;
> +        word_t zero = 0;
>          /* Versatile cannot currently sleep as it's timers
>           * will be turned off and it will never wake up
>           * so busy wait for now
> l
>
> ---------------------------------------------------------------------- 
> --
> Lukas Hänel wrote:
>> Hi
>> I am trying to port OKL4 to a platform based on the arm926ejs core.
>> Therefore I copied the xscale platform folder and changed the
>> tools/machines.py to be based on an other processor architecture.
>> E.g.
>> < class pxa(xscale):
>>> class pxa(arm926ejs):
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer




More information about the Developer mailing list