kldload issue: "Exec format error" with amd64 FreeBSD

Yong Rao yrao at force10networks.com
Fri Aug 10 21:59:40 UTC 2007


Thanks, Jung-uk, for your information. I will take a look at those
example modules.

-----Original Message-----
From: Jung-uk Kim [mailto:jkim at FreeBSD.org] 
Sent: Friday, August 10, 2007 2:06 PM
To: freebsd-amd64 at FreeBSD.org
Cc: Yong Rao
Subject: Re: kldload issue: "Exec format error" with amd64 FreeBSD

On Friday 10 August 2007 03:37 pm, Yong Rao wrote:
> Hi,
>
> I am porting a device driver from 32 bit FreeBSD OS (6.2) to amd64
> (6.2-RELEASE-p7).
>
> The compiling passed without any problem. But while I do kldload
> the module, we got problem.
>
> kldload: can't load ./pnicdrv.ko: Exec format error
>
> the dmesg displayed
>
> kldload: Unsupported file type
> kldload: unexpected relocation type 7
> link_elf: symbol strcpy undefined
>
> What the problem is?

Probably you have hardcoded CFLAGS/LDFLAGS?  You cannot do that.  
Also, you have to include bsd.kmod.mk at the end of your Makefile.

> In the compiling option we added extra "-m64 -fPIC ...". What
> particular options/flags else we should add in?

You don't need -m64 nor -fPIC.

> Is there example makefile(device driver code set) we can refer to?

There are many examples in src/sys/modules.

Jung-uk Kim


More information about the freebsd-amd64 mailing list