+Mon Jun 16 19:12:51 1997 Geoff Keating <geoffk@ozemail.com.au>
+
+ * 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 <hjl@gnu.ai.mit.edu>
* symbols.c (copy_symbol_attributes): Copy BSF_OBJECT flag.
/* 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.
#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
#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
#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 \
#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 */
/* 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 *));