Kernel Extension link-editor duplicate symbol warnings

Kernel Extension link-editor duplicate symbol warnings

Post by Brian Rasmusse » Sat, 16 Mar 2002 06:48:28



I have a kernel extension that started getting duplicate symbol warnings
when I moved from AIX 4.3.2 to 4.3.3.  Here is what I am seeing:

/bin/ld -b"binder:/usr/lib/bind
glink:/lib/glink.o" -H512 -T512 -lcsys -lsys -bmap:xxxx.m -bl:xxxx.lm -bI:/l
ib/kernex.exp -bI:/lib/syscalls.exp -exx_config <list of object files that
were compiled properly for a kernel extension>

ld: 0711-224 WARNING: Duplicate symbol: .trchook
ld: 0711-224 WARNING: Duplicate symbol: trchook
ld: 0711-344 See the loadmap file xxxx.lm for more information.

After looking into it, I think the duplicate symbol warnings stem from the
"trchook" symbol being added to kernex.exp in 4.3.3.  The symbol was already
in syscalls.exp since 4.3.2.  I am importing it twice, once from kernex.exp
and once from syscalls.exp, and so that is why I am getting the duplicate
symbol warning.  Does that sound right?  The warnings don't cause any
problems with the code, but I'd like to get rid of them if I can. But I
don't think I'm doing anything wrong to generate these warnings.  I saw that
last October JG posted a similar problem. The only reply was:

Quote:>For a device driver or kernel extension, you shouldn't need
>to use syscalls.exp. Only symbols listed in kernex.exp
>are available to your kernel module.

If I don't use syscalls.exp I get a lot of undefined symbols. I looked at
the AIX 4.3 documenation in the book "AIX Version 4.3 Kernel Extensions and
Device Support Programming Concepts", and here is a sentence straight from
Chapter1:

Kernel extensions can bind to a restricted set of base system calls. Binding
is done by specifying the syscalls.exp system call export file as an import
file when the kernel extension is link-edited.

So if I understand correctly, using syscalls.exp should be OK.  Is there
anything I can do to get rid of these warnings?

Thanks in advance,
BR

 
 
 

Kernel Extension link-editor duplicate symbol warnings

Post by Gary R. Hoo » Sun, 17 Mar 2002 02:30:03



> I have a kernel extension that started getting duplicate symbol warnings
> when I moved from AIX 4.3.2 to 4.3.3.  Here is what I am seeing:

> /bin/ld -b"binder:/usr/lib/bind
> glink:/lib/glink.o" -H512 -T512 -lcsys -lsys -bmap:xxxx.m -bl:xxxx.lm -bI:/l
> ib/kernex.exp -bI:/lib/syscalls.exp -exx_config <list of object files that
> were compiled properly for a kernel extension>

> ld: 0711-224 WARNING: Duplicate symbol: .trchook
> ld: 0711-224 WARNING: Duplicate symbol: trchook
> ld: 0711-344 See the loadmap file xxxx.lm for more information.

IIRC the -T512 and -H512 options are default.  You likely do not need
them
any longer.

Don't import syscalls.exp.  The whole point of creating kernex.exp was
to provide a single import list for kernel symbols that can be called
from
a kernel extension or device driver.  System calls are not necessarily
legal (unless they've been defined as supporting it) for calling from
kern exts or drivers.  Therefore, don't use that file any longer.

Quote:> >For a device driver or kernel extension, you shouldn't need
> >to use syscalls.exp. Only symbols listed in kernex.exp
> >are available to your kernel module.

> If I don't use syscalls.exp I get a lot of undefined symbols. I looked at
> the AIX 4.3 documenation in the book "AIX Version 4.3 Kernel Extensions and
> Device Support Programming Concepts", and here is a sentence straight from
> Chapter1:

> Kernel extensions can bind to a restricted set of base system calls. Binding
> is done by specifying the syscalls.exp system call export file as an import
> file when the kernel extension is link-edited.

The change in import lists occurred _after_ that book was written.  It
(the book) is now incorrect.  Apparently needs updating.

Verify that symbols you are referencing may be called from a kernel
extension.  It is possible that what you're attempting to do is fraught
with danger.  If it's not listed in kernex.exp, check with AIX
support, but it's probably that you can't legally call that function.

--
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
________________________________________________________________________

 
 
 

Kernel Extension link-editor duplicate symbol warnings

Post by Brian Rasmusse » Sun, 17 Mar 2002 07:54:46


Quote:> IIRC the -T512 and -H512 options are default.  You likely do not need
> them
> any longer.

Thanks for the tip on those options.

Quote:> Verify that symbols you are referencing may be called from a kernel
> extension.  It is possible that what you're attempting to do is fraught
> with danger.  If it's not listed in kernex.exp, check with AIX
> support, but it's probably that you can't legally call that function.

I'll probably have to check with AIX support on some of these like you
suggested, but here is the list of the undefined symbols I get when I try to
compile without syscalls.exp:
Trconflag
setpri
thread_self
getpid
_system_configuration
shmget
shmat
shmdt
__divus
gettimer
thread_create
thread_terminate
errno
__divss
__mull
getuidx

Are there routines that will do the same thing as many of the routines
listed above that are now imported in kerex.exp, and what are they?  For
example, it looks like kernex.exp contains kthread_self_getpid that I can
use instead of getpid, and there's a getptid that might replace thread_self
(although I haven't been able to find any documentation about either of
those routines outside of the prototype in the /usr/include/sys header
files), but I couldn't find anything similar to thread_create and some of
the others.  I don't want my kernel extension to call routines that could be
dangerous to use, but I have to be able to create multiple threads in my
kernel extension.  Do you know of any available routines that I can use to
resolve some of these other symbols?

Thanks,
BR

 
 
 

Kernel Extension link-editor duplicate symbol warnings

Post by Gary R. Hoo » Wed, 20 Mar 2002 00:58:06



> I'll probably have to check with AIX support on some of these like you
> suggested, but here is the list of the undefined symbols I get when I try to
> compile without syscalls.exp:
> thread_self

On a 5.1.0.15 system, this symbol is in kernex.exp

Quote:> setpri
> getpid

As are these...

Quote:> _system_configuration

And this

Quote:> shmget
> shmat
> shmdt

and these

Quote:> errno

Uh-uh.  Errno is on a per-thread basis in the kernel.  There is
no such thing as plain ol' errno in a kernel extension.  And any attempt
to use it should rightfully just crater your system.

Quote:> __divus
> __divss
> __mull

These are millicode routines in low memory, which are also defined
in kernex.exp.

The 5L versions of kernex.exp and syscalls.exp will be properly
segregated;
unfortunately, the 4.3 versions aren't.  If you can, compare the
routines you're
using to the files on a 5.1 system; otherwise, be sure to check the
Kernel Extensions
programming guide, or go to support and ask them.

--
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
________________________________________________________________________

 
 
 

1. link-editor for the removal of global symbols

Is there a link-editor avaible which allows the removal (or keeping) of
specific symbols?  The use is to allow the linking of several object files
into a code module, while keeping specific global symbols for this multi-file
module local only to the resulting .o file.  This would make multi-file
modules independent of other modules, avoiding symbol conflicts between
modules.

Ken Poppleton

2. test

3. Duplicate symbol warnings from linker - device driver compilation under 4.3.3 and 5L

4. test from mmain

5. Duplicate symbol warnings when compiling shared library using gcc

6. Help W/Unix Shell Script - File Splitting Based on Text String

7. Linker Warnings, 0711-224, duplicate symbols

8. 32meg 70ns 72pin EDO simm for $140

9. Trying to eliminate duplicate symbol warnings

10. Duplicate Symbol Warnings

11. statically linking with duplicate symbols

12. Detection of duplicate symbols during link phase

13. how to build and link a kernel extension