From e70f2bde6f7c829b936727150a55c105bb8be9f4 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 14 Jan 1994 19:55:42 +0000 Subject: [PATCH] * nlmconv.c (setup_sections): Make sure that we align the output_offset of each input section appropriately. --- binutils/ChangeLog | 5 +++++ binutils/nlmconv.c | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b1303710970..68466a4c163 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 14 14:42:48 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * nlmconv.c (setup_sections): Make sure that we align the + output_offset of each input section appropriately. + Thu Jan 13 17:32:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * objdump.c (dump_relocs): Don't crash if section name is NULL. diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index 7fa4c2a6353..94d36580240 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -97,9 +97,11 @@ static struct option long_options[] = { "debug", no_argument, 0, 'd' }, { "header-file", required_argument, 0, 'T' }, { "help", no_argument, 0, 'h' }, - { "input-format", required_argument, 0, 'I' }, + { "input-target", required_argument, 0, 'I' }, + { "input-format", required_argument, 0, 'I' }, /* Obsolete */ { "linker", required_argument, 0, 'l' }, - { "output-format", required_argument, 0, 'O' }, + { "output-target", required_argument, 0, 'O' }, + { "output-format", required_argument, 0, 'O' }, /* Obsolete */ { "version", no_argument, 0, 'V' }, { NULL, no_argument, 0, 0 } }; @@ -804,7 +806,7 @@ main (argc, argv) } if (map_file != NULL) fprintf (stderr, - "%s: MAP and FULLMAP are not supported; try ld -M\n", + "%s: warning: MAP and FULLMAP are not supported; try ld -M\n", program_name); if (help_file != NULL) { @@ -989,8 +991,8 @@ show_usage (file, status) int status; { fprintf (file, "\ -Usage: %s [-dhV] [-I format] [-O format] [-T header-file] [-l linker]\n\ - [--input-format=format] [--output-format=format]\n\ +Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n\ + [--input-target=bfdname] [--output-target=bfdname]\n\ [--header-file=file] [--linker=linker] [--debug]\n\ [--help] [--version]\n\ [in-file [out-file]]\n", @@ -1039,6 +1041,9 @@ setup_sections (inbfd, insec, data_ptr) flagword f; const char *outname; asection *outsec; + bfd_vma offset; + bfd_size_type align; + bfd_size_type add; /* FIXME: We don't want to copy the .reginfo section of an ECOFF file. However, I don't have a good way to describe this section. @@ -1066,11 +1071,16 @@ setup_sections (inbfd, insec, data_ptr) } insec->output_section = outsec; - insec->output_offset = bfd_section_size (outbfd, outsec); + + offset = bfd_section_size (outbfd, outsec); + align = 1 << bfd_section_alignment (inbfd, insec); + add = ((offset + align - 1) &~ (align - 1)) - offset; + insec->output_offset = offset + add; if (! bfd_set_section_size (outbfd, outsec, (bfd_section_size (outbfd, outsec) - + bfd_section_size (inbfd, insec)))) + + bfd_section_size (inbfd, insec) + + add))) bfd_fatal ("set section size"); if ((bfd_section_alignment (inbfd, insec) -- 2.30.2