From 24a3e622625b02ac66b456d96e7ac47789e237da Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 16 Jun 1997 23:17:22 +0000 Subject: [PATCH] Mon Jun 16 19:12:51 1997 Geoff Keating * config/tc-ppc.h (tc_fix_adjustable): Don't let the assembler calculate relocations to any external symbol, because we might be linking a shared object and the symbol might be overriden or moved (for instance, moved into a static executable's .bss section). (GLOBAL_OFFSET_TABLE_NAME): Delete. This is an i386 wierdness. * config/tc-ppc.h (tc_fix_adjustable): GOT-based relocations can't be calculated by the assembler. * config/tc-ppc.c (md_apply_fix3): Handle @plt or @local branch whose destination lies in the same file, by ignoring the @plt or @local and aiming the branch at its destination. --- gas/ChangeLog | 15 +++++++++++++++ gas/config/tc-ppc.h | 46 +++++++++++++++++++++++++--------------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 135cb32..08bab53 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +Mon Jun 16 19:12:51 1997 Geoff Keating + + * config/tc-ppc.h (tc_fix_adjustable): Don't let the assembler + calculate relocations to any external symbol, because we might be + linking a shared object and the symbol might be overriden or moved + (for instance, moved into a static executable's .bss section). + (GLOBAL_OFFSET_TABLE_NAME): Delete. This is an i386 wierdness. + + * config/tc-ppc.h (tc_fix_adjustable): GOT-based relocations can't + be calculated by the assembler. + + * config/tc-ppc.c (md_apply_fix3): Handle @plt or @local branch + whose destination lies in the same file, by ignoring the @plt or + @local and aiming the branch at its destination. + Mon Jun 16 13:59:18 1997 H.J. Lu * symbols.c (copy_symbol_attributes): Copy BSF_OBJECT flag. diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index d12a873..e8797a7 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -1,5 +1,5 @@ /* tc-ppc.h -- Header file for tc-ppc.c. - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -21,6 +21,15 @@ #define TC_PPC +#ifdef ANSI_PROTOTYPES +struct fix; +#endif + +/* Set the endianness we are using. Default to big endian. */ +#ifndef TARGET_BYTES_BIG_ENDIAN +#define TARGET_BYTES_BIG_ENDIAN 1 +#endif + #ifndef BFD_ASSEMBLER #error PowerPC support requires BFD_ASSEMBLER #endif @@ -74,24 +83,10 @@ extern int target_big_endian; #define NO_STRING_ESCAPES #endif -/* When using COFF, we determine whether or not to output a symbol - based on sy_tc.output, not on the name. */ -#ifdef OBJ_XCOFF -#define LOCAL_LABEL(name) 0 -#endif #ifdef OBJ_ELF -/* When using ELF, local labels start with '.'. */ -#define LOCAL_LABEL(name) (name[0] == '.' \ - && (name[1] == 'L' || name[1] == '.')) -#define FAKE_LABEL_NAME ".L0\001" #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ #endif -/* Set the endianness we are using. Default to big endian. */ -#ifndef TARGET_BYTES_BIG_ENDIAN -#define TARGET_BYTES_BIG_ENDIAN 1 -#endif - #if TARGET_BYTES_BIG_ENDIAN #define PPC_BIG_ENDIAN 1 #else @@ -195,12 +190,6 @@ extern void ppc_adjust_symtab PARAMS ((void)); #endif /* OBJ_XCOFF */ #ifdef OBJ_ELF -/* The name of the global offset table generated by the compiler. Allow - this to be overridden if need be. */ -#ifndef GLOBAL_OFFSET_TABLE_NAME -#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" -#endif - /* Branch prediction relocations must force relocation */ #define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \ ((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \ @@ -236,6 +225,20 @@ extern int ppc_section_flags PARAMS ((int, int, int)); #define tc_comment_chars ppc_comment_chars extern const char *ppc_comment_chars; +/* Keep relocations relative to the GOT, or non-PC relative. */ +#define tc_fix_adjustable(FIX) \ + ((FIX)->fx_r_type != BFD_RELOC_16_GOTOFF && \ + (FIX)->fx_r_type != BFD_RELOC_LO16_GOTOFF && \ + (FIX)->fx_r_type != BFD_RELOC_HI16_GOTOFF && \ + (FIX)->fx_r_type != BFD_RELOC_HI16_S_GOTOFF && \ + (FIX)->fx_r_type != BFD_RELOC_GPREL16 && \ + ! S_IS_EXTERNAL ((FIX)->fx_addsy) \ + && ! S_IS_WEAK ((FIX)->fx_addsy) \ + && ((FIX)->fx_pcrel \ + || ((FIX)->fx_subsy != NULL \ + && (S_GET_SEGMENT ((FIX)->fx_subsy) \ + == S_GET_SEGMENT ((FIX)->fx_addsy))))) + #endif /* OBJ_ELF */ /* call md_apply_fix3 with segment instead of md_apply_fix */ @@ -243,6 +246,7 @@ extern const char *ppc_comment_chars; /* call md_pcrel_from_section, not md_pcrel_from */ #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); #define md_parse_name(name, exp) ppc_parse_name (name, exp) extern int ppc_parse_name PARAMS ((const char *, struct expressionS *)); -- 2.7.4