aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-09-27 17:30:19 +0000
committerAlan Modra <amodra@gmail.com>2000-09-27 17:30:19 +0000
commit47d89dba5e87eb8f200e5f1a8a37d71716856a6d (patch)
tree35e27d3ec96747bf2587c7ca2f96f6a70b93c938 /ld
parent5506e1a5d86d957f3e71068785509d96d81e46a9 (diff)
downloadgdb-47d89dba5e87eb8f200e5f1a8a37d71716856a6d.zip
gdb-47d89dba5e87eb8f200e5f1a8a37d71716856a6d.tar.gz
gdb-47d89dba5e87eb8f200e5f1a8a37d71716856a6d.tar.bz2
.plt stub for lazy linking, --stub-group-size=N ld switch,
import stub fix, extra DIR14F reloc to fix abort in tc_gen_reloc
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog12
-rw-r--r--ld/emultempl/hppaelf.em35
-rw-r--r--ld/ld.texinfo33
3 files changed, 77 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3ae3e01..c4b2a3a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2000-09-28 Alan Modra <alan@linuxcare.com.au>
+
+ * ld.texinfo (HPPA ELF32): New section.
+
+ * emultempl/hppaelf.em (group_size): New.
+ (hppaelf_finish): Pass group_size to elf32_hppa_size_stubs.
+ (PARSE_AND_LIST_PROLOGUE): Add OPTION_STUBGROUP_SIZE.
+ (PARSE_AND_LIST_LONGOPTS): Add --stub-group-size. Duplicate
+ options to prevent abbreviations matching.
+ (PARSE_AND_LIST_OPTIONS): Describe the above. Reformat.
+ (PARSE_AND_LIST_ARGS_CASES): Handle it.
+
2000-09-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* emultempl/m68kelf.em: Conditionalise the embedded relocs feature
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 3455cc8..065bcdd 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -44,6 +44,10 @@ static lang_input_statement_type *stub_file;
stubs. */
static int multi_subspace = 0;
+/* Maximum size of a group of input sections that can be handled by
+ one stub section. A value of +/-1 indicates the bfd back-end
+ should use a suitable default size. */
+static bfd_signed_vma group_size = 1;
/* This is called before the input files are opened. We create a new
fake input file to hold the stub sections. */
@@ -292,6 +296,7 @@ hppaelf_finish ()
stub_file->the_bfd,
&link_info,
multi_subspace,
+ group_size,
&hppaelf_add_stub_section,
&hppaelf_layaout_sections_again))
{
@@ -349,16 +354,31 @@ EOF
#
PARSE_AND_LIST_PROLOGUE='
#define OPTION_MULTI_SUBSPACE 301
+#define OPTION_STUBGROUP_SIZE (OPTION_MULTI_SUBSPACE + 1)
'
+# The options are repeated below so that no abbreviations are allowed.
+# Otherwise -s matches stub-group-size
PARSE_AND_LIST_LONGOPTS='
- { "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE},
+ { "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE },
+ { "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE },
+ { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
+ { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _("\
- --multi-subspace Generate import and export stubs to support\n\
- multiple sub-space shared libraries\n"
+ --multi-subspace Generate import and export stubs to support\n\
+ multiple sub-space shared libraries\n"
+ ));
+ fprintf (file, _("\
+ --stub-group-size=N Maximum size of a group of input sections that can be\n\
+ handled by one stub section. A negative value\n\
+ locates all stubs before their branches (with a\n\
+ group size of -N), while a positive value allows\n\
+ two groups of input sections, one before, and one\n\
+ after each stub section. Values of +/-1 indicate\n\
+ the linker should choose suitable defaults."
));
'
@@ -366,6 +386,15 @@ PARSE_AND_LIST_ARGS_CASES='
case OPTION_MULTI_SUBSPACE:
multi_subspace = 1;
break;
+
+ case OPTION_STUBGROUP_SIZE:
+ {
+ const char *end;
+ group_size = bfd_scan_vma (optarg, &end, 0);
+ if (*end)
+ einfo (_("%P%F: invalid number `%s'\''\n"), optarg);
+ }
+ break;
'
# Put these extra hppaelf routines in ld_${EMULATION_NAME}_emulation
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index e907e30..0b898ec 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -3904,6 +3904,7 @@ functionality are not listed.
* H8/300:: @code{ld} and the H8/300
* i960:: @code{ld} and the Intel 960 family
* ARM:: @code{ld} and the ARM family
+* HPPA ELF32:: @code{ld} and HPPA 32-bit ELF
@ifset TICOFF
* TI COFF:: @code{ld} and TI COFF
@end ifset
@@ -4047,6 +4048,38 @@ But it also sets the bottom bit of the address, so that it can be
branched to using a BX instruction, and the program will start
executing in Thumb mode straight away.
+@node HPPA ELF32
+@section @code{ld} and HPPA 32-bit ELF support
+@cindex HPPA multiple sub-space stubs
+@kindex --multi-subspace
+When generating a shared library, @code{ld} will by default generate
+import stubs suitable for use with a single sub-space application.
+The @samp{--multi-subspace} switch causes @code{ld} to generate export
+stubs, and different (larger) import stubs suitable for use with
+multiple sub-spaces.
+
+@cindex HPPA stub grouping
+@kindex --stub-group-size=@var{N}
+Long branch stubs and import/export stubs are placed by @code{ld} in
+stub sections located between groups of input sections.
+@samp{--stub-group-size} specifies the maximum size of a group of input
+sections handled by one stub section. Since branch offsets are signed,
+a stub section may serve two groups of input sections, one group before
+the stub section, and one group after it. However, when using
+conditional branches that require stubs, it may be better (for branch
+prediction) that stub sections only serve one group of input sections.
+A negative value for @samp{N} chooses this scheme, ensuring that
+branches to stubs always use a negative offset. Two special values of
+@samp{N} are recognized, @samp{1} and @samp{-1}. These both instruct
+@code{ld} to automatically size input section groups for the branch types
+detected, with the same behaviour regarding stub placement as other
+positive or negative values of @samp{N} respectively.
+
+Note that @samp{--stub-group-size} does not split input sections. A
+single input section larger than the group size specified will of course
+create a larger group (of one section). If input sections are too
+large, it may not be possible for a branch to reach its stub.
+
@ifset TICOFF
@node TI COFF
@section @code{ld}'s support for various TI COFF versions