From 32715d71b8a446546cc4ce2e134a80d76e462e94 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 2 Feb 1998 17:44:57 +0000 Subject: [PATCH] Mon Feb 2 12:39:05 1998 Geoff Keating * config/tc-ppc.c (md_apply_fix3): Change BFD_RELOC_HI16 and BFD_RELOC_HI16_S to store the high bits of any value. * config/tc-ppc.h (tc_fix_adjustable): Undo change of Fri Jun 27. (TC_RELOC_RTSYM_LOC_FIXUP): Don't let the assembler calculate relocations to any external symbol at all. * config/tc-ppc.c (md_apply_fix3) [OBJ_ELF]: Correct bugs involving generation of pc-relative relocs. (md_pcrel_from_section) [OBJ_ELF]: The job this code used to do has been moved to md_apply_fix3. * config/tc-ppc.c (md_apply_fix3): Fix test for too-far branch. (ppc_elf_suffix): Warn about 'identifier+constant@got' syntax, which actually means (the address of identifier's GOT entry) + constant, which is not particularly useful. --- gas/ChangeLog | 18 ++++++++++++++++++ gas/config/tc-ppc.h | 42 +++++++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 60fb8d7..75f9715 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,21 @@ +Mon Feb 2 12:39:05 1998 Geoff Keating + + * config/tc-ppc.c (md_apply_fix3): Change BFD_RELOC_HI16 and + BFD_RELOC_HI16_S to store the high bits of any value. + + * config/tc-ppc.h (tc_fix_adjustable): Undo change of Fri Jun 27. + (TC_RELOC_RTSYM_LOC_FIXUP): Don't let the + assembler calculate relocations to any external symbol at all. + * config/tc-ppc.c (md_apply_fix3) [OBJ_ELF]: Correct bugs + involving generation of pc-relative relocs. + (md_pcrel_from_section) [OBJ_ELF]: The job this code used to do + has been moved to md_apply_fix3. + + * config/tc-ppc.c (md_apply_fix3): Fix test for too-far branch. + (ppc_elf_suffix): Warn about 'identifier+constant@got' syntax, + which actually means (the address of identifier's GOT entry) + + constant, which is not particularly useful. + Fri Jan 30 11:02:35 1998 Doug Evans * read.h (include_dirs): Declare. diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index d21610c..6b17f01 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, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -84,7 +84,7 @@ extern int target_big_endian; #endif #ifdef OBJ_ELF -#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ +#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ #endif #if TARGET_BYTES_BIG_ENDIAN @@ -190,13 +190,8 @@ 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 */ +/* Branch prediction relocations must force relocation. */ #define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \ ((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \ || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN \ @@ -231,13 +226,30 @@ 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. */ -#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) +/* 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))))) + +/* We must never ever try to resolve references to externally visible + symbols in the assembler, because the .o file might go into a shared + library, and some other shared library might override that symbol. */ +#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \ + ((FIX)->fx_addsy == NULL \ + || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ + && ! S_IS_WEAK ((FIX)->fx_addsy) \ + && S_IS_DEFINED ((FIX)->fx_addsy) \ + && ! S_IS_COMMON ((FIX)->fx_addsy))) + #endif /* OBJ_ELF */ /* call md_apply_fix3 with segment instead of md_apply_fix */ -- 2.7.4