File: 112_fix_reloc_sizing.dpatch

package info (click to toggle)
binutils 2.15-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 86,288 kB
  • ctags: 93,872
  • sloc: ansic: 672,886; asm: 243,857; exp: 44,950; makefile: 29,286; sh: 17,224; lisp: 7,387; yacc: 5,855; lex: 1,520; perl: 1,383; cpp: 1,339; sed: 522; pascal: 175; awk: 26
file content (71 lines) | stat: -rw-r--r-- 2,788 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/sh -e
## 112_fix_reloc_sizing.dpatch
##
## DP: Description: Objcopy fix for relocation sections. (#252719)
## DP: Author: Alan Modra <amodra@bigpond.net.au>
## DP: Upstream status: Under discussion
## DP: Date: 2004-09-08
## DP: URL: http://sources.redhat.com/ml/binutils/2004-09/msg00080.html

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/james/debian/packages/binutils/binutils-2.15/bfd/elf.c binutils-2.15/bfd/elf.c
--- /home/james/debian/packages/binutils/binutils-2.15/bfd/elf.c	2004-09-09 18:12:16.394893161 +0100
+++ binutils-2.15/bfd/elf.c	2004-09-09 18:33:50.217988088 +0100
@@ -4174,10 +4174,13 @@
    _bfd_elf_compute_section_file_positions.  All the section sizes and
    VMAs must be known before this is called.
 
-   We do not consider reloc sections at this point, unless they form
-   part of the loadable image.  Reloc sections are assigned file
-   positions in assign_file_positions_for_relocs, which is called by
-   write_object_contents and final_link.
+   Reloc sections come in two flavours: Those processed specially as
+   "side-channel" data attached to a section to which they apply, and
+   those that bfd doesn't process as relocations.  The latter sort are
+   stored in a normal bfd section by bfd_section_from_shdr.   We don't
+   consider the former sort here, unless they form part of the loadable
+   image.  Reloc sections not assigned here will be handled later by
+   assign_file_positions_for_relocs.
 
    We also don't set the positions of the .symtab and .strtab here.  */
 
@@ -4209,8 +4212,8 @@
 	  Elf_Internal_Shdr *hdr;
 
 	  hdr = *hdrpp;
-	  if (hdr->sh_type == SHT_REL
-	      || hdr->sh_type == SHT_RELA
+	  if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
+	       && hdr->bfd_section == NULL)
 	      || i == tdata->symtab_section
 	      || i == tdata->symtab_shndx_section
 	      || i == tdata->strtab_section)
@@ -4265,7 +4268,9 @@
 	      off = _bfd_elf_assign_file_position_for_section (hdr, off,
 							       FALSE);
 	    }
-	  else if (hdr == i_shdrpp[tdata->symtab_section]
+	  else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
+		    && hdr->bfd_section == NULL)
+		   || hdr == i_shdrpp[tdata->symtab_section]
 		   || hdr == i_shdrpp[tdata->symtab_shndx_section]
 		   || hdr == i_shdrpp[tdata->strtab_section])
 	    hdr->sh_offset = -1;