From 5f3548d6c755c7ddda69071cc80aa9f1f905ea24 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 24 Jan 1995 16:01:04 +0000 Subject: [PATCH] update copyrights --- ld/emultempl/elf32.em | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index a5f6ec5..43c2cc4 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c < ELF support by Ian Lance Taylor @@ -114,6 +114,7 @@ static void gld${EMULATION_NAME}_before_allocation () { asection *sinterp; + lang_input_statement_type *is; /* If we are going to make any variable assignments, we need to let the ELF backend know about them in case the variables are @@ -137,6 +138,42 @@ gld${EMULATION_NAME}_before_allocation () sinterp->contents = (bfd_byte *) command_line.interpreter; sinterp->_raw_size = strlen (command_line.interpreter) + 1; } + + /* Look for any sections named .gnu.warning. As a GNU extensions, + we treat such sections as containing warning messages. We print + out the warning message, and then zero out the section size so + that it does not get copied into the output file. */ + + { + LANG_FOR_EACH_INPUT_STATEMENT (is) + { + asection *s; + bfd_size_type sz; + char *msg; + boolean ret; + + if (is->just_syms_flag) + continue; + + s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning"); + if (s == NULL) + continue; + + sz = bfd_section_size (is->the_bfd, s); + msg = xmalloc ((size_t) sz + 1); + if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz)) + einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n", + is->the_bfd); + msg[sz] = '\0'; + ret = link_info.callbacks->warning (&link_info, msg); + ASSERT (ret); + free (msg); + + /* Clobber the section size, so that we don't waste copying the + warning into the output file. */ + s->_raw_size = 0; + } + } } /* This is called by the before_allocation routine via @@ -246,6 +283,16 @@ gld${EMULATION_NAME}_place_orphan (file, s) secname = bfd_get_section_name (s->owner, s); + /* When generating an object which is to be dynamically linked, we + do not support orphaned reloc sections. This is because all the + reloc sections must be contiguous in order to generate correct + DT_REL entries. When this case arises, you can just add the + appropriate reloc sections to the linker script. Note that the + .rel.plt section must always be the last reloc section. FIXME: + This should simply be handled correctly here. */ + ASSERT (strncmp (secname, ".rel", 4) != 0 + || bfd_get_section_by_name (output_bfd, ".dynamic") == NULL); + /* Create the section in the output file, and put it in the right place. This shuffling to make the output file look neater, and also means that the BFD backend does not have to sort the @@ -405,6 +452,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = syslib_default, hll_default, after_parse_default, + after_open_default, after_allocation_default, set_output_arch_default, ldemul_default_target, -- 2.7.4