This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: a question about gas
- From: Nick Clifton <nickc at redhat dot com>
- To: Lope De Vega <lope dot vega at yahoo dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 11 Oct 2007 11:36:32 +0100
- Subject: Re: a question about gas
- References: <834694.82087.qm@web45505.mail.sp1.yahoo.com>
Hi Lope,
I find there are a few inconsistencies within the
documentation and what actually gas does. Which I can
remember right now is for example the use of
STT_FUNCTION, like this:
..globl my_func
..type my_func STT_FUNCTION
leads to:
main.S:23: Error: unrecognized symbol type
"STT_FUNCTION"
This is because the type should be "STT_FUNC" not "STT_FUNCTION".
What I wanted to ask is how should I do to define a
global symbol, thus, I'm using several files, so I did
setup a common.S (I go via gcc), and made a small
macro, such a file looks like this:
..text
..macro global_def sym, val
.globl \sym
.equ \sym, \val
..endm
.global_def _sys_brk, 45
If you are using gcc to drive the assembler, why not just use the C
preprocessor to do this sort of thing for you ? eg:
% cat common.S
#define _sys_brk 45
% cat prog.S
movl _sys_brk, %eax
Cheers
Nick