Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain Rather than hacking it with __NetBSD__, l...



details:   https://anonhg.NetBSD.org/src/rev/1040bf7281ef
branches:  trunk
changeset: 503584:1040bf7281ef
user:      tv <tv%NetBSD.org@localhost>
date:      Fri Feb 09 17:23:46 2001 +0000

description:
Rather than hacking it with __NetBSD__, leverage ld --traditional-format to
flag the old elf64-alpha PLT format (in use by NetBSD/alpha ld.elf_so).

diffstat:

 gnu/dist/toolchain/bfd/elf64-alpha.c             |  48 ++++++++++++------------
 gnu/dist/toolchain/gcc/config/alpha/netbsd-elf.h |  10 +++++
 2 files changed, 34 insertions(+), 24 deletions(-)

diffs (85 lines):

diff -r 0e360b1c848a -r 1040bf7281ef gnu/dist/toolchain/bfd/elf64-alpha.c
--- a/gnu/dist/toolchain/bfd/elf64-alpha.c      Fri Feb 09 15:54:18 2001 +0000
+++ b/gnu/dist/toolchain/bfd/elf64-alpha.c      Fri Feb 09 17:23:46 2001 +0000
@@ -1665,16 +1665,14 @@
 #define PLT_HEADER_WORD4       0x6b7b0000      /* jmp  $27,($27)   */
 
 #define PLT_ENTRY_SIZE 12
-#ifdef __NetBSD__
-/* XXX. XXX. For NetBSD 1.3 compatibility - should be fixed better */
-#define PLT_ENTRY_WORD1                0x279f0000      /* ldah $28, 0($31) */
-#define PLT_ENTRY_WORD2                0x239c0000      /* lda  $28, 0($28) */
-#define PLT_ENTRY_WORD3                0xc3e00000      /* br   $31, plt0   */
-#else
 #define PLT_ENTRY_WORD1                0xc3800000      /* br   $28, plt0   */
 #define PLT_ENTRY_WORD2                0
 #define PLT_ENTRY_WORD3                0
-#endif
+
+/* ld --traditional-format uses this older format instead. */
+#define OLD_PLT_ENTRY_WORD1    0x279f0000      /* ldah $28, 0($31) */
+#define OLD_PLT_ENTRY_WORD2    0x239c0000      /* lda  $28, 0($28) */
+#define OLD_PLT_ENTRY_WORD3    0xc3e00000      /* br   $31, plt0   */
 
 #define MAX_GOT_ENTRIES                (64*1024 / 8)
 
@@ -3780,23 +3778,25 @@
       {
        unsigned insn1, insn2, insn3;
 
-#ifdef __NetBSD__
-/* XXX. XXX. For NetBSD 1.3 compatibility - should be fixed better */
-       long hi, lo;
-
-       /* decompose the reloc offset for the plt for ldah+lda */
-       hi = plt_index * sizeof(Elf64_External_Rela);
-       lo = ((hi & 0xffff) ^ 0x8000) - 0x8000;
-       hi = (hi - lo) >> 16;
-
-       insn1 = PLT_ENTRY_WORD1 | (hi & 0xffff);
-       insn2 = PLT_ENTRY_WORD2 | (lo & 0xffff);
-       insn3 = PLT_ENTRY_WORD3 | ((-(h->plt.offset + 12) >> 2) & 0x1fffff);
-#else
-       insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff);
-       insn2 = PLT_ENTRY_WORD2;
-       insn3 = PLT_ENTRY_WORD3;
-#endif
+       if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
+         {
+           long hi, lo;
+
+           /* decompose the reloc offset for the plt for ldah+lda */
+           hi = plt_index * sizeof(Elf64_External_Rela);
+           lo = ((hi & 0xffff) ^ 0x8000) - 0x8000;
+           hi = (hi - lo) >> 16;
+
+           insn1 = OLD_PLT_ENTRY_WORD1 | (hi & 0xffff);
+           insn2 = OLD_PLT_ENTRY_WORD2 | (lo & 0xffff);
+           insn3 = OLD_PLT_ENTRY_WORD3 | ((-(h->plt.offset + 12) >> 2) & 0x1fffff);
+         }
+       else
+         {
+           insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff);
+           insn2 = PLT_ENTRY_WORD2;
+           insn3 = PLT_ENTRY_WORD3;
+         }
 
        bfd_put_32 (output_bfd, insn1, splt->contents + h->plt.offset);
        bfd_put_32 (output_bfd, insn2, splt->contents + h->plt.offset + 4);
diff -r 0e360b1c848a -r 1040bf7281ef gnu/dist/toolchain/gcc/config/alpha/netbsd-elf.h
--- a/gnu/dist/toolchain/gcc/config/alpha/netbsd-elf.h  Fri Feb 09 15:54:18 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/alpha/netbsd-elf.h  Fri Feb 09 17:23:46 2001 +0000
@@ -30,3 +30,13 @@
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
 
 #define ELF_DYNAMIC_LINKER     "/usr/libexec/ld.elf_so"
+
+#undef LINK_SPEC
+#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}         \
+  %{O*:-O3} %{!O*:-O1}                                         \
+  %{shared:-shared}                                            \
+  %{!shared:                                                   \
+    %{!static:                                                 \
+      %{rdynamic:-export-dynamic}                              \
+      %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}}        \
+    %{static:-static}} --traditional-format"



Home | Main Index | Thread Index | Old Index