From c96386c4d8bd690856b5742cd783492e8ec9e806 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 15 Jun 1994 06:01:45 +0000 Subject: [PATCH] * ld.h (ld_config_type): Add new field traditional_format. * lexsup.c (parse_args): Add traditional_format to longopts, and handle it. * ldmain.c (main): Initialize config.traditional_format to false. * ldlang.c (ldlang_open_output): Set BFD_TRADITIONAL_FORMAT in BFD flags of output_bfd according to config.traditional_format. * ld.texinfo: Document -traditional-format. --- ld/ChangeLog | 10 ++++++++++ ld/ld.h | 3 +++ ld/ld.texinfo | 18 +++++++++++++++++- ld/ldlang.c | 4 ++++ ld/ldmain.c | 1 + ld/lexsup.c | 11 ++++++++--- 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0e6e23acccb..0685b609989 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +Wed Jun 15 01:54:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * ld.h (ld_config_type): Add new field traditional_format. + * lexsup.c (parse_args): Add traditional_format to longopts, and + handle it. + * ldmain.c (main): Initialize config.traditional_format to false. + * ldlang.c (ldlang_open_output): Set BFD_TRADITIONAL_FORMAT in BFD + flags of output_bfd according to config.traditional_format. + * ld.texinfo: Document -traditional-format. + Tue Jun 14 23:10:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * ldctor.c (ldctor_add_entry): Add entries to a set in the order diff --git a/ld/ld.h b/ld/ld.h index 2ab94f60a6d..ff654a650a1 100644 --- a/ld/ld.h +++ b/ld/ld.h @@ -61,6 +61,9 @@ typedef struct boolean magic_demand_paged; boolean make_executable; + /* If true, request BFD to use the traditional format. */ + boolean traditional_format; + /* If true, doing a dynamic link. */ boolean dynamic_link; diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 65a9d1065ac..d60c5e87532 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -179,7 +179,8 @@ ld [ -o @var{output} ] @var{objfile}@dots{} [ -r | -Ur ] [ -S ] [ -s ] [ -sort-common ] [ -stats ] [ -T @var{commandfile} ] [ -Ttext @var{org} ] [ -Tdata @var{org} ] - [ -Tbss @var{org} ] [ -t ] [ -u @var{symbol}] [-V] [-v] [ -version ] + [ -Tbss @var{org} ] [ -t ] [ -traditional-format ] + [ -u @var{symbol}] [-V] [-v] [ -version ] [ -warn-common ] [ -y @var{symbol} ] [ -X ] [-x ] @end smallexample @@ -597,6 +598,21 @@ preceding @samp{-L} options. Multiple @samp{-T} options accumulate. @item -t Print the names of the input files as @code{ld} processes them. +@kindex -traditional-format +@cindex traditional format +@item -traditional-format +For some targets, the output of @code{ld} is different in some ways from +the output of some existing linker. This switch requests @code{ld} to +use the traditional format instead. + +@cindex dbx +For example, on SunOS, @code{ld} combines duplicate entries in the +symbol string table. This can reduce the size of an output file with +full debugging information by over 30 percent. Unfortunately, the SunOS +@code{dbx} program can not read the resulting program (@code{gdb} has no +trouble). The @samp{-traditional-format} switch tells @code{ld} to not +combine duplicate entries. + @item -u @var{symbol} @kindex -u @var{symbol} @cindex undefined symbol diff --git a/ld/ldlang.c b/ld/ldlang.c index 93a7d673799..36a85534b0c 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -889,6 +889,10 @@ ldlang_open_output (statement) output_bfd->flags |= WP_TEXT; else output_bfd->flags &= ~WP_TEXT; + if (config.traditional_format) + output_bfd->flags |= BFD_TRADITIONAL_FORMAT; + else + output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT; break; case lang_target_statement_enum: diff --git a/ld/ldmain.c b/ld/ldmain.c index 3109bbbe59b..bfe74f049f1 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -158,6 +158,7 @@ main (argc, argv) /* Initialize the data about options. */ trace_files = trace_file_tries = version_printed = false; + config.traditional_format = false; config.build_constructors = true; config.dynamic_link = false; command_line.force_common_definition = false; diff --git a/ld/lexsup.c b/ld/lexsup.c index 8b1a1cd1459..7a88a9c0e69 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -99,11 +99,13 @@ parse_args (argc, argv) {"Tdata", required_argument, NULL, OPTION_TDATA}, #define OPTION_TTEXT 167 {"Ttext", required_argument, NULL, OPTION_TTEXT}, -#define OPTION_UR 168 +#define OPTION_TRADITIONAL_FORMAT 168 + {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}, +#define OPTION_UR 169 {"Ur", no_argument, NULL, OPTION_UR}, -#define OPTION_VERSION 169 +#define OPTION_VERSION 170 {"version", no_argument, NULL, OPTION_VERSION}, -#define OPTION_WARN_COMMON 170 +#define OPTION_WARN_COMMON 171 {"warn-common", no_argument, NULL, OPTION_WARN_COMMON}, {NULL, no_argument, NULL, 0} }; @@ -279,6 +281,9 @@ parse_args (argc, argv) case OPTION_TTEXT: set_section_start (".text", optarg); break; + case OPTION_TRADITIONAL_FORMAT: + config.traditional_format = true; + break; case OPTION_UR: link_info.relocateable = true; config.build_constructors = true; -- 2.30.2