tizen 2.3 release
[external/binutils.git] / packaging / fixbug13534_4.patch
1 commit 70ed6152e1e163b9ca240fe8b91aa3feb942ac84
2 Author: Francois Gouget <fgouget@codeweavers.com>
3 Date:   Tue Dec 20 18:45:18 2011 +0100
4
5     bfd: Always use bfd_size_type to manipulate the size of an archive element.
6     
7     Other types may not be able to deal with archive elements larger than 2GB.
8
9 diff --git a/bfd/archive.c b/bfd/archive.c
10 index 01acf98..c1438ef 100644
11 --- a/bfd/archive.c
12 +++ b/bfd/archive.c
13 @@ -748,7 +748,7 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
14      filestart = bfd_ardata (archive)->first_file_filepos;
15    else
16      {
17 -      unsigned int size = arelt_size (last_file);
18 +      bfd_size_type size = arelt_size (last_file);
19  
20        filestart = last_file->proxy_origin;
21        if (! bfd_is_thin_archive (archive))
22 @@ -946,7 +946,7 @@ do_slurp_coff_armap (bfd *abfd)
23    struct artdata *ardata = bfd_ardata (abfd);
24    char *stringbase;
25    bfd_size_type stringsize;
26 -  unsigned int parsed_size;
27 +  bfd_size_type parsed_size;
28    carsym *carsyms;
29    bfd_size_type nsymz;         /* Number of symbols in armap.  */
30    bfd_vma (*swap) (const void *);
31 @@ -2174,7 +2174,7 @@ _bfd_write_archive_contents (bfd *arch)
32         current = current->archive_next)
33      {
34        char buffer[DEFAULT_BUFFERSIZE];
35 -      unsigned int remaining = arelt_size (current);
36 +      bfd_size_type remaining = arelt_size (current);
37  
38        /* Write ar header.  */
39        if (!_bfd_write_ar_hdr (arch, current))
40 diff --git a/bfd/bfdio.c b/bfd/bfdio.c
41 index 841c781..5bc8061 100644
42 --- a/bfd/bfdio.c
43 +++ b/bfd/bfdio.c
44 @@ -185,7 +185,7 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
45       this element.  */
46    if (abfd->arelt_data != NULL)
47      {
48 -      size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size;
49 +      bfd_size_type maxbytes = arelt_size (abfd);
50        if (abfd->where + size > maxbytes)
51          {
52            if (abfd->where >= maxbytes)
53 diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
54 index a4ba4b6..683c1cc 100644
55 --- a/bfd/libbfd-in.h
56 +++ b/bfd/libbfd-in.h
57 @@ -90,8 +90,8 @@ struct artdata {
58  /* Goes in bfd's arelt_data slot */
59  struct areltdata {
60    char * arch_header;          /* it's actually a string */
61 -  unsigned int parsed_size;    /* octets of filesize not including ar_hdr */
62 -  unsigned int extra_size;     /* BSD4.4: extra bytes after the header.  */
63 +  bfd_size_type parsed_size;   /* octets of filesize not including ar_hdr */
64 +  bfd_size_type extra_size;    /* BSD4.4: extra bytes after the header.  */
65    char *filename;              /* null-terminated */
66    file_ptr origin;             /* for element of a thin archive */
67  };
68 diff --git a/bfd/libbfd.h b/bfd/libbfd.h
69 index 7f142d0..6d27901 100644
70 --- a/bfd/libbfd.h
71 +++ b/bfd/libbfd.h
72 @@ -95,8 +95,8 @@ struct artdata {
73  /* Goes in bfd's arelt_data slot */
74  struct areltdata {
75    char * arch_header;          /* it's actually a string */
76 -  unsigned int parsed_size;    /* octets of filesize not including ar_hdr */
77 -  unsigned int extra_size;     /* BSD4.4: extra bytes after the header.  */
78 +  bfd_size_type parsed_size;   /* octets of filesize not including ar_hdr */
79 +  bfd_size_type extra_size;    /* BSD4.4: extra bytes after the header.  */
80    char *filename;              /* null-terminated */
81    file_ptr origin;             /* for element of a thin archive */
82  };
83