From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 24 02:35:18 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A384B1065672 for ; Wed, 24 Mar 2010 02:35:18 +0000 (UTC) (envelope-from mahan@mahan.org) Received: from ns.mahan.org (ns.mahan.org [67.116.10.138]) by mx1.freebsd.org (Postfix) with ESMTP id 6CA4A8FC0C for ; Wed, 24 Mar 2010 02:35:18 +0000 (UTC) Received: from Gypsy.mahan.org (crowTrobot [67.116.10.140]) by ns.mahan.org (8.13.6/8.13.6) with ESMTP id o2O2bo2N034602 for ; Tue, 23 Mar 2010 19:37:51 -0700 (PDT) (envelope-from mahan@mahan.org) Message-ID: <4BA97A65.10507@mahan.org> Date: Tue, 23 Mar 2010 19:35:17 -0700 From: Patrick Mahan User-Agent: Thunderbird 2.0.0.22 (X11/20090605) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Using __attribute__((weak)) in the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2010 02:35:18 -0000 All, Has anyone used the "weak" function attribute in the kernel? I have some modules providing APIs that I want to allow them to be either loaded via kldload or directly built in the kernel. However, the API functions are being referenced by code that cannot (at this time) be moved out of the kernel. If I understand the use of the "weak" attribute, I should be able to define these functions as "weak" and they should be over-written either by the real code functions at kernel link or when kldload() is called. Or am I mis-understanding the use of this attribute? Thanks, Patrick