From owner-freebsd-drivers@FreeBSD.ORG Mon Nov 3 06:43:48 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A1B1725C for ; Mon, 3 Nov 2014 06:43:48 +0000 (UTC) Received: from CMEXEDGE1.ext.emulex.com (cmexedge1.emulex.com [138.239.224.99]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "CMEXEDGE1", Issuer "CMEXEDGE1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B166F5A for ; Mon, 3 Nov 2014 06:43:47 +0000 (UTC) Received: from CMEXHTCAS1.ad.emulex.com (138.239.115.217) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sun, 2 Nov 2014 22:28:51 -0800 Received: from CMEXMB1.ad.emulex.com ([169.254.1.58]) by CMEXHTCAS1.ad.emulex.com ([2002:8aef:71b7::8aef:71b7]) with mapi id 14.03.0174.001; Sun, 2 Nov 2014 22:28:27 -0800 From: Nagesh Akula To: "freebsd-drivers@freebsd.org" Subject: ZLIB FreeBSD 9.1 version + deflateInit_ Symbol not found Thread-Topic: ZLIB FreeBSD 9.1 version + deflateInit_ Symbol not found Thread-Index: Ac/3LabexlXkZ/khQJuvvxhc0zsvIA== Date: Mon, 3 Nov 2014 06:28:26 +0000 Message-ID: <383FAC81A1B4D54E8BF7C31A699555FF11DE48DA@CMEXMB1.ad.emulex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [138.239.140.58] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2014 06:43:48 -0000 Hi, I am trying to add compression algorithm within the kernel module. For this, I have included library calls. With this getting an linker error, in FreeBSD 9.1 OS version, getting kldload linker error on deflateInit_ sym= bol. link_elf_obj: symbol deflateInit_ undefined linker_load_file: Unsupported file type But, in FreeBSD 10.0 version, the zlib library is able to link properly, an= d module is working fine. Please let me know, if there is any way to link ZLIB with our module in Fre= eBSD 9.1 ? Thank you. -NAKULA. Below are additional details: Tested OS revision: # uname -a FreeBSD FreeBSD-170 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 = 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GEN= ERIC amd64 Tested module file used for ZLIB issue reproduction: #include #include #include /* uprintf */ #include #include /* defines used in kernel.h */ #include /* types used in module initialization */ #include #include #include void skel_zlib_test(void); static void * z_alloc(void *unused, uint32_t items, uint32_t size) { void *ptr; ptr =3D malloc(items * size, M_DEVBUF, M_NOWAIT|M_ZERO); return ptr; } static void z_free(void *opaque, void *ptr) { free(ptr, M_DEVBUF); } void skel_zlib_test(void) { z_stream zInfo; int rc; zInfo.zalloc =3D (alloc_func)z_alloc; zInfo.zfree =3D (free_func)z_free; zInfo.opaque =3D NULL; rc =3D deflateInit(&zInfo, Z_DEFAULT_COMPRESSION); deflateEnd(&zInfo); } /* * Load handler that deals with the loading and unloading of a KLD. */ static int skel_loader(struct module *m, int what, void *arg) { int err =3D 0; switch (what) { case MOD_LOAD: /* kldload */ uprintf("Skeleton KLD loaded.\n"); skel_zlib_test(); break; case MOD_UNLOAD: uprintf("Skeleton KLD unloaded.\n"); break; default: err =3D EOPNOTSUPP; break; } return(err); } /* Declare this module to the rest of the kernel */ static moduledata_t skel_mod =3D { "skel", skel_loader, NULL }; DECLARE_MODULE(skeleton, skel_mod, SI_SUB_KLD, SI_ORDER_ANY); --- Makefile: SRCS=3Dskel.c KMOD=3Dskel .include Error: # kldload ./skel.ko # dmesg link_elf_obj: symbol deflateInit_ undefined linker_load_file: Unsupported file type