This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
gas on Mac OS X
- From: Martin Schaffner <schaffner at gmx dot li>
- To: binutils at sources dot redhat dot com
- Date: Sat, 19 Jun 2004 19:19:02 +0200
- Subject: gas on Mac OS X
Me and Aurelien Chanudet started porting GNU assembler to the
powerpc-apple-darwin* target. It already parses the assembler output of
a hello world C program, but can't yet generate Mach-O files.
I am currently stuck with design issues, and I don't know enough about
BFD and assemblers in general to make competent decisions, so if you
do, please speak up. I'll present the issues in the last part of this
e-mail.
My copyright assignment has been accepted by the FSF.
All work we did up to now is here:
http://membres.lycos.fr/schaffner/prog/binutils/
Please review and apply the following:
----------------------------------
1) binutils-add-comments.ptch has nothing to do with darwin, it just
adds some comments.
ChangeLog:
2004-04-21 Martin Schaffner <schaffner@gmx.li>
* gas/write.c, gas/config/tc-ppc.h: comment #endif with controlling
macro
* binutils-darwin-add-reloc-types.patch adds relocation type
definitions for mach-o. ChangeLog:
2004-06-19 Martin Schaffner <schaffner@gmx.li>
* bfd/bfd-in2.h, bfd/libbfd.h, bfd/reloc.c: define Mach-O-specific
relocation types:
BFD_RELOC_LO16_DS, BFD_RELOC_LO16_DS_BASEREL,
BFD_RELOC_MACH_O_PAIR, BFD_RELOC_MACH_O_PB_LA_PTR,
BFD_RELOC_MACH_O_JBSR
* binutils-darwin-parse.patch (depends on the previous) adds support
for the assembler operators lo16(), hi16(), ha16(). ChangeLog:
2004-04-21 Martin Schaffner <schaffner@gmx.li>
* gas/config/tc-ppc.c: add support for Mach-O-specific assembly code
2) binutils-darwin-2004-6-19-safe.patch (to be applied after adding the
files gas/config/obj-mach-o.{c,h}) contains darwin-related changes that
should be "safe" to apply and should not influence other targets.
ChangeLog:
2004-06-19 Martin Schaffner <schaffner@gmx.li>
* gas/config/obj-mach-o.c, gas/config/obj-mach-o.h: new files for
Mach-O support
* gas/Makefile.in, gas/Makefile.am, gas/configure.in,
gas/configure.am: add support for gas/config/obj-mach-o.{h,c}
* bfd/mach-o.c: define MACH_O_MAGIC, move and rename macros for
sections to bfd/mach-o.h
* bfd/mach-o.h: add macros for mach-o sections
Future development
-----------------------
The rest of the patches is work in progress.
binutils-darwin-parse.patch enables gas to parse the hello world example
binutils-darwin-activate.patch tells the build system that darwin is a
possible target - to be applied when everything else works
binutils-darwin-add-reloc-types.patch adds Mach-O-specific relocation
types to BFD
binutils-darwin-2004-4-21.patch is all patches from 2004-4-21 combined.
http://membres.lycos.fr/schaffner/prog/binutils/quoted_names.ptch adds
(incorrect) support for quote-delimited identifers
mach-o-reloc.c is a file for the bfd directory, but I hope it finally
won't be necessary.
cctools-495.tar.bz2 is a copy of apple's assembler source code
gas-apple.ptch is a diff between apple's assembler and gas-1.38, the
version which apple forked to make their assembler
Design issues
--------------
Mach-O has two unique features: Indirect Symbols and Weak References.
The proper way to support them is probably to add support to bfd. Can a
BFD expert speak up on how to add this?
Here is the previous discussion, which ended because I hadn't completed
my copyright assignment yet:
http://sources.redhat.com/ml/binutils/2004-04/msg00510.html
http://sources.redhat.com/ml/binutils/2004-04/msg00546.html
--
Martin Schaffner