[M3devel] how to port to new target

Jay K jay.krell at cornell.edu
Thu Jul 16 05:25:48 CEST 2009


"how to port"
 
I know there is a web already but maybe it needs updating. (Maybe not, basically just one item stricken/reduced).
 
 
Based on the AMD64_NETBSD/OPENBSD work (ChangeLog entry), and /assuming/
gcc has already been ported, here is a/the specific
current list of files that need visiting for porting:
 

    add a file to m3-sys/cminstall/src/config-no-install 
    m3-sys/m3middle/src/Target.m3 
    m3-sys/m3middle/src/Target.i3 (trivial, just add to the list) 
    m3-libs/m3core/src/runtime/common/Compiler.tmpl (trivial) 
 
 
    add m3-libs/m3core/src/C/TARGET/Csetjmp.i3 (redundant with Target.m3) 
    add m3-libs/m3core/src/C/TARGET/m3makefile (trivial, always the same) 
 
 
    all these trivial:
      m3-libs/m3core/src/thread.quake 
      m3-libs/libm3/src/os/POSIX/m3makefile 
      m3-libs/libm3/src/random/m3makefile 
      m3-libs/m3core/src/C/Common/m3makefile 
      m3-libs/m3core/src/Csupport/m3makefile 
      m3-libs/m3core/src/float/m3makefile 
      m3-libs/m3core/src/runtime/m3makefile 
      m3-libs/m3core/src/runtime/POSIX/m3makefile 
      m3-libs/m3core/src/runtime/common/m3makefile 
      m3-libs/m3core/src/time/POSIX/m3makefile 
      m3-libs/m3core/src/unix/Common/m3makefile 
 

plus off the top of my head:
  scripts/sysinfo.sh -- platform detection using uname etc.
  scripts/python/pylib.py -- platform detection and possible changes to "boot" (redundant with config file sorry) 
  m3-sys/m3cc/src/m3makefile -- at least add the TARGET => GNU_PLATFORM
    mapping for building a cross compiler; sometimes more is needed 
  m3-sys/m3gdb/src/m3makefile -- ditto
  m3-libs/m3core/src/runtime/POSIX/RTSignalC.c
    for adding a new processor for Solaris or NetBSD, maybe already portable,
    but otherwise this file is highly target specific, though you can
    also just fallback and return 0.
    I'd rather not put in the fallback,
    lest porters don't get a "reminder".
    They can always make it so upon being reminded.
    (The reminder comes unfortunately late -- when native building the boot archive on the target platform.)

 
 plus some possible revisitation of:
  m3-libs/m3core/src/unix/Common but
    often just works.
 

  Adding a new processor for Darwin is a
   little different than other platforms.
   Threading is a little different, in a good
    way and you might to use Apple's fork of gcc (see m3cc/m3makefile, look for ARM_DARWIN).
 

 In future maybe things go a little different,
  like if there are more builtin backends
  or stack walkers. (Though I'm hoping for
  a fairly portable stack walker using libgcc/libunwind.)
 
 
It should be possible to significantly reduce
this if you are only adding another processor
for an existing OS, or just another
OS for existing processor.
 

A lot of the checks only depend on endian or OS.
Granted it is not a long list asis.
 
 
If there is non-Posix non-NT platform, more work.
 

 - Jay


More information about the M3devel mailing list