From 48fa4a5def1116273c2c2a236939e96eb9b6231a Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 1 Feb 2002 08:24:03 +0000 Subject: [PATCH] Support on-demand global register allocation from R_MMIX_BASE_PLUS_OFFSET relocs. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): Rename from mmix_set_reg_section_vma. Call _bfd_mmix_finalize_linker_allocated_gregs. (mmix_before_allocation): New function. (LDEMUL_AFTER_ALLOCATION): Set to mmix_after_allocation. (LDEMUL_BEFORE_ALLOCATION): Define to mmix_before_allocation. * scripttempl/mmo.sc (.text): Mark .init, .fini as KEEP. (.MMIX.reg_contents): Add .MMIX.reg_contents.linker_allocated before .MMIX.reg_contents. * emultempl/mmo.em (gldmmo_before_allocation): Define to default. (mmo_after_open): New function. (LDEMUL_AFTER_OPEN): Define to mmo_after_open. * emulparams/elf64mmix.sh (OTHER_SECTIONS): Tweak formatting. Add .MMIX.reg_contents.linker_allocated before .MMIX.reg_contents. --- ld/ChangeLog | 19 ++++++++++++++ ld/emulparams/elf64mmix.sh | 5 ++-- ld/emultempl/mmix-elfnmmo.em | 51 +++++++++++++++++++++++++++++------- ld/emultempl/mmo.em | 28 +++++++++++++++++++- ld/scripttempl/mmo.sc | 5 ++-- 5 files changed, 93 insertions(+), 15 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 5b3eb4829e8..1ab57bc31a5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,22 @@ +2002-02-01 Hans-Peter Nilsson + + Support on-demand global register allocation from + R_MMIX_BASE_PLUS_OFFSET relocs. + * emultempl/mmix-elfnmmo.em (mmix_after_allocation): Rename from + mmix_set_reg_section_vma. Call + _bfd_mmix_finalize_linker_allocated_gregs. + (mmix_before_allocation): New function. + (LDEMUL_AFTER_ALLOCATION): Set to mmix_after_allocation. + (LDEMUL_BEFORE_ALLOCATION): Define to mmix_before_allocation. + * scripttempl/mmo.sc (.text): Mark .init, .fini as KEEP. + (.MMIX.reg_contents): Add .MMIX.reg_contents.linker_allocated + before .MMIX.reg_contents. + * emultempl/mmo.em (gldmmo_before_allocation): Define to default. + (mmo_after_open): New function. + (LDEMUL_AFTER_OPEN): Define to mmo_after_open. + * emulparams/elf64mmix.sh (OTHER_SECTIONS): Tweak formatting. Add + .MMIX.reg_contents.linker_allocated before .MMIX.reg_contents. + 2002-01-31 Ivan Guzvinec * emulparams/or32.sh: New file. diff --git a/ld/emulparams/elf64mmix.sh b/ld/emulparams/elf64mmix.sh index c811ce084bd..1ee92832891 100644 --- a/ld/emulparams/elf64mmix.sh +++ b/ld/emulparams/elf64mmix.sh @@ -44,14 +44,15 @@ OTHER_TEXT_SECTIONS=' PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.)); ' -OTHER_SECTIONS=" +OTHER_SECTIONS=' .MMIX.reg_contents : { /* Note that this section always has a fixed VMA - that of its first register * 8. */ + *(.MMIX.reg_contents.linker_allocated); *(.MMIX.reg_contents); } -" +' # FIXME: Also bit by the PROVIDE bug? If not, this could be # EXECUTABLE_SYMBOLS. diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em index d1058b1cfc6..1b72a643baf 100644 --- a/ld/emultempl/mmix-elfnmmo.em +++ b/ld/emultempl/mmix-elfnmmo.em @@ -1,5 +1,5 @@ # This shell script emits a C file. -*- C -*- -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001, 2002 Free Software Foundation, Inc. # # This file is part of GLD, the Gnu Linker. # @@ -24,13 +24,38 @@ cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <the_bfd) == bfd_target_elf_flavour + && !_bfd_mmix_check_all_relocs (is->the_bfd, &link_info)) + einfo ("%X%P: Internal problems scanning %B after opening it", + is->the_bfd); + } +} EOF LDEMUL_PLACE_ORPHAN=mmo_place_orphan LDEMUL_FINISH=mmo_finish +LDEMUL_AFTER_OPEN=mmo_after_open diff --git a/ld/scripttempl/mmo.sc b/ld/scripttempl/mmo.sc index 5b9ef853226..72e8b49dab2 100644 --- a/ld/scripttempl/mmo.sc +++ b/ld/scripttempl/mmo.sc @@ -16,12 +16,12 @@ SECTIONS /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */ ${RELOCATING+ PROVIDE (_init_start = .);} ${RELOCATING+ PROVIDE (_init = .);} - ${RELOCATING+ *(.init)} + ${RELOCATING+ KEEP (*(.init))} ${RELOCATING+ PROVIDE (_init_end = .);} ${RELOCATING+ PROVIDE (_fini_start = .);} ${RELOCATING+ PROVIDE (_fini = .);} - ${RELOCATING+ *(.fini)} + ${RELOCATING+ KEEP (*(.fini))} ${RELOCATING+ PROVIDE (_fini_end = .);} /* FIXME: Align ctors, dtors, ehframe. */ @@ -115,6 +115,7 @@ SECTIONS { /* Note that this section always has a fixed VMA - that of its first register * 8. */ + *(.MMIX.reg_contents.linker_allocated); *(.MMIX.reg_contents); } -- 2.30.2