Subject: LKM linking problem on an arm SBC
To: None <tech-toolchain@netbsd.org>
From: Christos Eleftheriadis <christos.eleftheriadis@gmail.com>
List: tech-toolchain
Date: 03/21/2006 09:39:15
Greetings,

Some background info first
I am trying to write an LKM device driver for an ADC PC104 card. The
SBC is the TS7200 (an SBC based on EP9302).

But before dive into the actual driver I wanted to test my environment
so I managed to compile the fibonacci module from
http://home.unix-ag.org/bmeurer/NetBSD/howto-lkm.html

The SBC runs NetBSD3.0 with LKM on

Here is the problem

when I try to load the compiled module I get the following error



arm# modload -e fibo_lkmentry -p fibo_post.sh fibo.o
ld: internal error: aborting at
/home/builds/ab/netbsd-3-0-RELEASE/src/gnu/dist/binutils/ld/ldlang.c
line 3835 in lang_place_orphans
ld: please report this bug
modload: can't prelink `fibo.o' creating `fibo'
arm#

Has anyone seen such a thing ?
I get also similar output when I try to load a cross compiled fibo.o
build on an i386...

Below is the output from the compile

arm# make
#   compile  LKM/main.o
cc -O2 -ffreestanding  -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wno-sign-compare -Wno-traditional -Wno-uninitialized
-Werror   -nostdinc -nostdinc -I. -I/root/LKM -isystem /usr/src/sys
-isystem /usr/src/sys/arch -D_KERNEL -D_LKM  -c    main.c
ld -r  -o tmp.o main.o
mv tmp.o fibo_tmp.o
objdump --syms --reloc fibo_tmp.o |  awk -f
/usr/src/sys/lkm/arch/arm/lkmtramp.awk > tmp.S
mv tmp.S fibo_tramp.S
#   compile  LKM/fibo_tramp.o
cc    -nostdinc -nostdinc -I. -I/root/LKM -isystem /usr/src/sys
-isystem /usr/src/sys/arch -D_KERNEL -D_LKM  -c -traditional-cpp
fibo_tramp.S
ld -r   `objdump --syms --reloc fibo_tmp.o |  awk -f
/usr/src/sys/lkm/arch/arm/lkmwrap.awk`  -o tmp.o fibo_tmp.o
fibo_tramp.o
objcopy  `nm tmp.o | awk -f /usr/src/sys/lkm/arch/arm/lkmhide.awk`  tmp.o t=
mp1.o
mv tmp1.o tmp.o
mv tmp.o fibo.o


Regards
Christos