#include "sections.h"
#include "obstack.h"
#include "frags.h"
#include "fixes.h"
#include "symbols.h"
#include "input-scrub.h"
#include <mach-o/x86_64/reloc.h>
fixS *
fix_new(
fragS *frag,
int where,
int size,
symbolS *add_symbol,
symbolS *sub_symbol,
signed_target_addr_t
offset,
int pcrel,
int pcrel_reloc,
int r_type)
{
struct fix *fixP;
fixP = (struct fix *)obstack_alloc(¬es, sizeof(struct fix));
fixP->fx_frag = frag;
fixP->fx_where = where;
fixP->fx_size = size;
fixP->fx_addsy = add_symbol;
fixP->fx_subsy = sub_symbol;
fixP->fx_offset = offset;
fixP->fx_pcrel = pcrel;
fixP->fx_pcrel_reloc = pcrel_reloc;
fixP->fx_r_type = r_type;
#if defined(I386) && defined(ARCH64)
if(fixP->fx_r_type == X86_64_RELOC_SIGNED){
switch(offset){
case -1:
fixP->fx_r_type = X86_64_RELOC_SIGNED_1;
break;
case -2:
fixP->fx_r_type = X86_64_RELOC_SIGNED_2;
break;
case -4:
fixP->fx_r_type = X86_64_RELOC_SIGNED_4;
break;
default:
break;
}
}
if(fixP->fx_r_type == X86_64_RELOC_GOT ||
fixP->fx_r_type == X86_64_RELOC_GOT_LOAD){
fixP->fx_pcrel = TRUE;
fixP->fx_pcrel_reloc = TRUE;
}
fixP->fx_localsy = symbol_new("L0\002", N_SECT, frchain_now->frch_nsect,
0, where, frag);
symbol_assign_index(fixP->fx_localsy);
#endif
as_file_and_line (&fixP->file, &fixP->line);
fixP->fx_next = frchain_now->frch_fix_root;
frchain_now->frch_fix_root = fixP;
return fixP;
}