1 | # $Id: op-darwin.sed 5999 2007-12-07 15:05:06Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # SED script for transforming op.S (i386 ELF from GNU/linux) into
|
---|
5 | # something that the Darwin (Mac OS X) assembler can make use of.
|
---|
6 | #
|
---|
7 |
|
---|
8 | #
|
---|
9 | # Copyright (C) 2006-2007 innotek GmbH
|
---|
10 | #
|
---|
11 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | # available from http://www.virtualbox.org. This file is free software;
|
---|
13 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | # General Public License (GPL) as published by the Free Software
|
---|
15 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | #
|
---|
19 |
|
---|
20 | # This is a generic transformation, only encountered with i386-elf-gcc-3.4.3 so far.
|
---|
21 | s/^\([[:blank:]]*\)\//\1#/
|
---|
22 |
|
---|
23 | # Darwin doesn't grok .type and .size, remove those lines.
|
---|
24 | /^[[:blank:]]*\.type[[:blank:]]/d
|
---|
25 | /^[[:blank:]]*\.size[[:blank:]]/d
|
---|
26 |
|
---|
27 | # Darwin names the .rodata section '.const'.
|
---|
28 | s/^[[:blank:]]*\.section[[:blank:]][[:blank:]]*\.rodata[[:blank:]]*$/\t.const/
|
---|
29 |
|
---|
30 | # Darwin doesn't grok the the .note.GNU-stack section, remove that line.
|
---|
31 | /^[[:blank:]]*\.section[[:blank:]][[:blank:]]*\.note\.GNU-stack,/d
|
---|
32 |
|
---|
33 | # .zero seems to be similar to .spaces...
|
---|
34 | s/^\([[:blank:]]*\)\.zero[[:blank:]][[:blank:]]*\([0-9][0-9]*\)/\1.space \2/
|
---|
35 |
|
---|
36 | # It looks like if .align is taking a byte count on linux and a power of
|
---|
37 | # two on Darwin, translate to power of two.
|
---|
38 | s/\.align 128/\.align 7/
|
---|
39 | s/\.align 64/\.align 6/
|
---|
40 | s/\.align 32/\.align 5/
|
---|
41 | s/\.align 16/\.align 4/
|
---|
42 | s/\.align 8/\.align 3/
|
---|
43 | s/\.align 4/\.align 2/
|
---|
44 | s/\.align 2/\.align 1/
|
---|
45 |
|
---|
46 |
|
---|
47 | # Darwin uses underscore prefixed names like the DOS based i386 OSes
|
---|
48 | # linux does. So, all global symbols needs to be translated.
|
---|
49 | s/^[[:blank:]]*\.globl[[:blank:]][[:blank:]]*\([^\t\n ]*\)[[:blank:]]*$/#define \1 _\1\n.globl \1/
|
---|
50 |
|
---|
51 | # special hack for __op_labelN
|
---|
52 | s/__op_label\([0-9]\)/___op_label\1/g
|
---|
53 |
|
---|