mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-21 12:27:33 +00:00
(unexec): Don't alter the info field of SHT_SYMTAB and SHT_DYNSYM sections.
This commit is contained in:
parent
b16234d848
commit
8917361f1f
1 changed files with 13 additions and 10 deletions
|
|
@ -725,20 +725,23 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
|
|||
|
||||
/* If any section hdr refers to the section after the new .data
|
||||
section, make it refer to next one because we have inserted
|
||||
a new section in between. */
|
||||
a new section in between. */
|
||||
|
||||
PATCH_INDEX (NEW_SECTION_H (nn).sh_link);
|
||||
PATCH_INDEX (NEW_SECTION_H (nn).sh_info);
|
||||
|
||||
/* Now, start to copy the content of sections. */
|
||||
/* For symbol tables, info is a symbol table index,
|
||||
so don't change it. */
|
||||
if (NEW_SECTION_H (nn).sh_type != SHT_SYMTAB
|
||||
&& NEW_SECTION_H (nn).sh_type != SHT_DYNSYM)
|
||||
PATCH_INDEX (NEW_SECTION_H (nn).sh_info);
|
||||
|
||||
/* Now, start to copy the content of sections. */
|
||||
if (NEW_SECTION_H (nn).sh_type == SHT_NULL
|
||||
|| NEW_SECTION_H (nn).sh_type == SHT_NOBITS)
|
||||
continue;
|
||||
|
||||
/* Write out the sections. .data and .data1 (and data2, called
|
||||
* ".data" in the strings table) get copied from the current process
|
||||
* instead of the old file.
|
||||
*/
|
||||
".data" in the strings table) get copied from the current process
|
||||
instead of the old file. */
|
||||
if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
|
||||
|| !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
|
||||
".data1"))
|
||||
|
|
@ -749,7 +752,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
|
|||
memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
|
||||
NEW_SECTION_H (nn).sh_size);
|
||||
|
||||
/* If it is the symbol table, its st_shndx field needs to be patched. */
|
||||
/* If it is the symbol table, its st_shndx field needs to be patched. */
|
||||
if (NEW_SECTION_H (nn).sh_type == SHT_SYMTAB
|
||||
|| NEW_SECTION_H (nn).sh_type == SHT_DYNSYM)
|
||||
{
|
||||
|
|
@ -769,7 +772,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
|
|||
}
|
||||
}
|
||||
|
||||
/* Update the symbol values of _edata and _end. */
|
||||
/* Update the symbol values of _edata and _end. */
|
||||
for (n = new_file_h->e_shnum - 1; n; n--)
|
||||
{
|
||||
byte *symnames;
|
||||
|
|
@ -789,7 +792,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
|
|||
memcpy (&symp->st_value, &new_bss_addr, sizeof (new_bss_addr));
|
||||
}
|
||||
|
||||
/* Close the files and make the new file executable */
|
||||
/* Close the files and make the new file executable. */
|
||||
|
||||
if (close (old_file))
|
||||
fatal ("Can't close (%s): errno %d\n", old_name, errno);
|
||||
|
|
|
|||
Loading…
Reference in a new issue