diff --git a/ld/ChangeLog b/ld/ChangeLog index c0f7c71981..89cbc473a0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +Tue Mar 12 12:43:59 1996 David Mosberger-Tang + + * ld.h (ld_config_type): Add warn_multiple_gp field. + * lexsup.c (parse_args): Handle --warn-multiple-gp. + * ldmain.c (warning_callback): Suppress multiple gp values warning + if --warn_multiple_gp was not used. + * ld.texinfo, ld.1: Document --warn-multiple-gp. + Tue Mar 12 12:02:21 1996 Ian Lance Taylor * configure: Rebuild with autoconf 2.8. diff --git a/ld/ld.1 b/ld/ld.1 index a52bf11cb2..802926cc6e 100644 --- a/ld/ld.1 +++ b/ld/ld.1 @@ -119,6 +119,7 @@ ld \- the GNU linker .RB "[\|" \-\-version "\|]" .RB "[\|" \-warn\-common "\|]" .RB "[\|" \-warn\-constructors "\|]" +.RB "[\|" \-warn\-multiple\-gp "\|]" .RB "[\|" \-warn\-once "\|]" .RB "[\|" \-\-whole\-archive "\|]" .RB "[\|" \-\-no\-whole\-archive "\|]" @@ -907,6 +908,11 @@ Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. +.TP +.B \-warn\-multiple\-gp +Warn if the output file requires multiple global-pointer values. This +option is only meaningful for certain processors, such as the Alpha. + .TP .B \-warn\-once Only warn once for each undefined symbol, rather than once per module diff --git a/ld/ld.texinfo b/ld/ld.texinfo index ad8ba4bc89..23fc78a81f 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -184,7 +184,7 @@ ld [ -o @var{output} ] @var{objfile}@dots{} [ -Ttext @var{org} ] [ -Tdata @var{org} ] [ -Tbss @var{org} ] [ -t ] [ -traditional-format ] [ -u @var{symbol}] [-V] [-v] [ -verbose] [ -version ] - [ -warn-common ] [ -warn-constructors] [ -warn-once ] + [ -warn-common ] [ -warn-constructors] [ -warn-multiple-gp ] [ -warn-once ] [ -y @var{symbol} ] [ -X ] [-x ] [ -( [ archives ] -) ] [ --start-group [ archives ] --end-group ] @@ -932,6 +932,20 @@ Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. +@kindex -warn-multiple-gp +@item -warn-multiple-gp +Warn if multiple global pointer values are required in the output file. +This is only meaningful for certain processors, such as the Alpha. +Specifically, some processors put large-valued constants in a special +section. A special register (the global pointer) points into the middle +of this section, so that constants can be loaded efficiently via a +base-register relative addressing mode. Since the offset in +base-register relative mode is fixed and relatively small (e.g., 16 +bits), this limits the maximum size of the constant pool. Thus, in +large programs, it is often necessary to use multiple global pointer +values in order to be able to address all possible constants. This +option causes a warning to be issued whenever this case occurs. + @kindex -warn-once @cindex warnings, on undefined symbols @cindex undefined symbols, warnings on @@ -941,6 +955,7 @@ which refers to it. @kindex --whole-archive @cindex including an entire archive +@item --whole-archive For each archive mentioned on the command line after the @code{--whole-archive} option, include every object file in the archive in the link, rather than searching the archive for the required object @@ -949,6 +964,7 @@ library, forcing every object to be included in the resulting shared library. @kindex --no-whole-archive +@item --no-whole-archive Turn off the effect of the @code{--whole-archive} option for archives which appear later on the command line. diff --git a/ld/ldmain.c b/ld/ldmain.c index 15fac43281..5dbfc55742 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -735,7 +735,7 @@ add_to_set (info, h, reloc, abfd, section, value) if (! config.build_constructors) return true; - ldctor_add_set_entry (h, reloc, section, value); + ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value); if (h->type == bfd_link_hash_new) { @@ -775,7 +775,9 @@ constructor_callback (info, constructor, name, abfd, section, value) /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a useful error message. */ - if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL) + if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL + && (link_info.relocateable + || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL)) einfo ("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"); s = set_name; @@ -802,7 +804,7 @@ constructor_callback (info, constructor, name, abfd, section, value) ourselves. */ } - ldctor_add_set_entry (h, BFD_RELOC_CTOR, section, value); + ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value); return true; } @@ -829,6 +831,12 @@ warning_callback (info, warning, symbol, abfd, section, address) asection *section; bfd_vma address; { + /* This is a hack to support warn_multiple_gp. FIXME: This should + have a cleaner interface, but what? */ + if (! config.warn_multiple_gp + && strcmp (warning, "using multiple gp values") == 0) + return true; + if (section != NULL) einfo ("%C: %s\n", abfd, section, address, warning); else if (abfd == NULL) diff --git a/ld/lexsup.c b/ld/lexsup.c index 1e5d5dcb03..d90b8c71ae 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -1,5 +1,5 @@ /* Parse options for the GNU linker. - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -103,7 +103,8 @@ parse_args (argc, argv) #define OPTION_VERSION (OPTION_VERBOSE + 1) #define OPTION_WARN_COMMON (OPTION_VERSION + 1) #define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1) -#define OPTION_WARN_ONCE (OPTION_WARN_CONSTRUCTORS + 1) +#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1) +#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1) #define OPTION_SPLIT_BY_RELOC (OPTION_WARN_ONCE + 1) #define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1) #define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1) @@ -159,6 +160,7 @@ parse_args (argc, argv) {"version", no_argument, NULL, OPTION_VERSION}, {"warn-common", no_argument, NULL, OPTION_WARN_COMMON}, {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS}, + {"warn-multiple-gp", no_argument, NULL, OPTION_WARN_MULTIPLE_GP}, {"warn-once", no_argument, NULL, OPTION_WARN_ONCE}, {"split-by-reloc", required_argument, NULL, OPTION_SPLIT_BY_RELOC}, {"split-by-file", no_argument, NULL, OPTION_SPLIT_BY_FILE}, @@ -487,6 +489,9 @@ parse_args (argc, argv) case OPTION_WARN_CONSTRUCTORS: config.warn_constructors = true; break; + case OPTION_WARN_MULTIPLE_GP: + config.warn_multiple_gp = true; + break; case OPTION_WARN_ONCE: config.warn_once = true; break;