Next | Prev | Up | Top | Contents | Index

Module Configuration

Each loadable module must contain the string shown below, where M_VERSION is defined in the mload.h header file that must be included by the loadable module:

char *drvmversion = M_VERSION;

A loadable module must be compiled and linked with the following cc options before it can be loaded into the kernel:[17]

% cc -non_shared -coff -Wx,-G0 -Wc,-pic0 -r -d -c -Wc,-jalr

-non_shared

Produce a static executable. The output object created does not use any shared objects during execution.

-coff

Produce a COFF object.

-Wx,-G0

Disable global pointer. Not supported for loadable modules.

-Wc,-pic0

Do not allocate extra stack space that is not necessary for non_shared coff objects.

-r

Retain relocation entries in the output file.

-d

Force definition of common storage and define loader-defined symbols. Without this option, space is not allocated in bss for common variables.

-c

Suppress the compilation loading phase and force an object file to be produced even if only one program is compiled.

-Wc,-jalr

Force the compiler to produce jalr instructions rather than jal instructions. A jal instruction has a 26-bit target, so if a module is loaded into k2seg, for example, it could not call a kernel function in k0seg.
A loadable module must not be dependent on any loadable module, other than a library module. In order to load a module comprised of multiple object files, the object files must be linked into a single object file, using ld with the following options:1

% ld -non_shared -coff -G0 -r -d

For more information, see the cc(1) and ld(1) man page entries.


[17] No driver written for IRIX 6.0 should use the -coff flag.

Next | Prev | Up | Top | Contents | Index