STLLUG - St. Louis Linux User Group
08/17/1995 : Linux Frontiers
Presenter: Matthew Feldt

Linux Frontiers

Matt Welsh
O'Reilly and Associates, Inc.


What is Linux?


More Information about Linux


Overview

ELF Support
Executable and Linkable Format: AT&T Binary Spec for Linux
iBCS2 Emulation
The standard for x86 UNIX binaries
WINE: The Windows Emulator
Run MS-Windows applications under Linux/X11R6
Loadable Kernel Modules
Load and unload kernel drivers dynamically

ELF

Executable and Linkable Format
Defines binary format for executables, object files, and libraries.
a.out and COFF
Two other binary formats: a.out originated at BSD, and used initially by Linux.
Advantages of ELF

ELF vs. a.out format

ELF vs. a.out file format

Building ELF Shared Libraries

  1. Build objects as PIC (position-independent) code:
    gcc -fPIC -O -c foo.c -o foo.o
  2. Link objects into shared object:
    gcc -shared -o libfoo.so foo.o bar.o ...
  3. To use shared libs, just link as normal:
    gcc -O -o baz baz.o -lfoo
    Uses libfoo.so shared lib automatically.

Dynamic Linking and Loading

ld.so
performs dynamic linking for executables at load time
libdl.a
allows you to do dynamic linking within a program
* dlopen() opens shared object, returns handle
* dlsym() looks up symbol from shared object, returns pointer
Can then use pointer (function or object) as usual

Dynamic Linking Example

  /* Open shared obj libfoo.so
   * RTLD_LAZY: Only relocate as necessary 
   */ 
  handle = dlopen( "libfoo.so", RTLD_LAZY ); 

  /* Look up symbol for thefunction() */
  funcptr = ( funcptr_t )dlsym( handle, "thefunction" ); 

  /* Call function from shared object */
  ( *fptr )(); 
Dynamic linking with ELF is easy and fun!

Upgrading to ELF

All tools at ftp://sunsite.unc.edu/pub/Linux/GCC

You will need:

iBCS2 Support

Intel Binary Compatibility Spec, v.2 iBCS2 for Linux

iBCS2 Features

Kernel emulator Personalities

iBCS2 Shared libraries


Supported Systems

Binary formats O/S emulations

Getting the Emulator

Files at tsx-11.mit.edu/pub/linux/BETA/ibcs2

ibcs-1.2-yymmdd.tar.gz
The kernel emulator
sco-libs-yymmdd.tar.gz
SCO shared libs
svr4-shlib-yymmdd.tar.gz
SVR4 shared libs
libc_s-yymmdd.tar.gz
iBCS2 libc source

Mail majordomo@vger.rutgers.edu for info on the linux-ibcs2 mailing list


WINE: The Windows Emulator

What is it? How well does it work?

Where can I get WINE?


WINE Program Loader


WINE Windows API Emulator


Loadable Kernel Modules

Dynamically loaded kernel code

What is a module?

Required Tools

Loading a Module

  1. Prepare module in user space
  2. Allocate kernel memory
  3. Load module into kernel memory
  4. Add exported module symbols to kernel
  5. Call init_module routine

Module Dependencies and Deletion

Deleting a module Dependencies

These are slides for the "Linux Frontiers" talk given for the O'Reilly and Associates "Running Linux '95" tour. For more information please contact Matt Welsh at mdw@cs.cornell.edu.

This file and associated slides are Copyright (c)1995 by Matt Welsh. You are free to copy and distribute this file (or slides produced thereof) VERBATIM in any medium, physical or electronic. This copyright notice should be entact on all copies and attribution to the author retained.

Update: mdw 21 August 1995


Links and conversion from Postscript to HTML done by Matthew Feldt.


Last Modified: 5 September 1995
St. Louis Unix Users Group - Linux SIG