[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Writing an object format backend

As with the CPU backend, the object format backend must define a few things, and may define some other things. The interface to the object format backend is generally simpler; most of the support for an object file format consists of defining a number of pseudo-ops.

The object format `.h' file must include `targ-cpu.h'.

This section will only define the BFD_ASSEMBLER version of GAS. It is impossible to support a new object file format using any other version anyhow, as the original GAS version only supports a.out, and the MANY_SEGMENTS GAS version only supports COFF.

OBJ_format
By convention, you should define this macro in the `.h' file. For example, `obj-elf.h' defines OBJ_ELF. You might have to use this if it is necessary to add object file format specific code to the CPU file.

obj_begin
If you define this macro, GAS will call it at the start of the assembly, after the command line arguments have been parsed and all the machine independent initializations have been completed.

obj_app_file
If you define this macro, GAS will invoke it when it sees a .file pseudo-op or a `#' line as used by the C preprocessor.

OBJ_COPY_SYMBOL_ATTRIBUTES
You should define this macro to copy object format specific information from one symbol to another. GAS will call it when one symbol is equated to another.

obj_sec_sym_ok_for_reloc
You may define this macro to indicate that it is OK to use a section symbol in a relocation entry. If it is not, GAS will define a new symbol at the start of a section.

EMIT_SECTION_SYMBOLS
You should define this macro with a zero value if you do not want to include section symbols in the output symbol table. The default value for this macro is one.

obj_adjust_symtab
If you define this macro, GAS will invoke it just before setting the symbol table of the output BFD. For example, the COFF support uses this macro to generate a .file symbol if none was generated previously.

SEPARATE_STAB_SECTIONS
You may define this macro to a nonzero value to indicate that stabs should be placed in separate sections, as in ELF.

INIT_STAB_SECTION
You may define this macro to initialize the stabs section in the output file.

OBJ_PROCESS_STAB
You may define this macro to do specific processing on a stabs entry.

obj_frob_section
If you define this macro, GAS will call it for each section at the end of the assembly.

obj_frob_file_before_adjust
If you define this macro, GAS will call it after the symbol values are resolved, but before the fixups have been changed from local symbols to section symbols.

obj_frob_symbol
If you define this macro, GAS will call it for each symbol. You can indicate that the symbol should not be included in the object file by defining this macro to set its second argument to a non-zero value.

obj_frob_file
If you define this macro, GAS will call it after the symbol table has been completed, but before the relocations have been generated.

obj_frob_file_after_relocs
If you define this macro, GAS will call it after the relocs have been generated.

SET_SECTION_RELOCS (sec, relocs, n)
If you define this, it will be called after the relocations have been set for the section sec. The list of relocations is in relocs, and the number of relocations is in n. This is only used with BFD_ASSEMBLER.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html