Ticket #37520: patch_as_ppc.diff

File patch_as_ppc.diff, 1.6 KB (added by internetzel, 11 years ago)
  • as/ppc.c

    old new  
    22#include <string.h>
    33#include <stdlib.h>
    44#include <mach-o/ppc/reloc.h>
     5#include "stuff/macosx_deployment_target.h"
    56#include "ppc-opcode.h"
    67#include "as.h"
    78#include "flonum.h"
     
    1718#include "sections.h"
    1819#include "dwarf2dbg.h"
    1920
     21/* The Mac OS X deployment target */
     22__private_extern__ struct macosx_deployment_target
     23        macosx_deployment_target = { 0 };
     24
    2025/*
    2126 * The assembler can assemble the trailing +/- by setting either the Y-bit or
    2227 * the AT-bits.  The default is setting the Y-bit and is the same as specifying:
     
    490495            add_to_macro_definition(ppc_macros[i].body);
    491496            s_endmacro(0);
    492497        }
     498
     499        /*
     500         * Pick up the Mac OS X deployment target.
     501         */
     502        get_macosx_deployment_target(&macosx_deployment_target);
    493503}
    494504
    495505/*
     
    12861296            param += 5;
    12871297        }
    12881298        else if(strncmp(param,"lo16(",5) == 0){
    1289             if(format->ops[parcnt].type == DS)
     1299            if((format->ops[parcnt].type == DS)
     1300               && (macosx_deployment_target.major < 4)) // PPC_RELOC_LO14 not supported and not needed by dyld on 10.4 and later
    12901301                insn->reloc = PPC_RELOC_LO14;
    12911302            else
    12921303                insn->reloc = PPC_RELOC_LO16;
     
    13711382            param += 5;
    13721383        }
    13731384        else if(strncmp(param,"lo16(",5) == 0){
    1374             if(format->ops[parcnt].type == DS)
     1385            if((format->ops[parcnt].type == DS)
     1386               && (macosx_deployment_target.major < 4)) // PPC_RELOC_LO14 not supported and not needed by dyld on 10.4 and later
    13751387                insn->reloc = PPC_RELOC_LO14;
    13761388            else
    13771389                insn->reloc = PPC_RELOC_LO16;