OLD | NEW |
1 /* ELF executable support for BFD. | 1 /* ELF executable support for BFD. |
2 | 2 |
3 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, | 3 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
4 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 4 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
5 Free Software Foundation, Inc. | 5 Free Software Foundation, Inc. |
6 | 6 |
7 This file is part of BFD, the Binary File Descriptor library. | 7 This file is part of BFD, the Binary File Descriptor library. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
12 (at your option) any later version. | 12 (at your option) any later version. |
13 | 13 |
14 This program is distributed in the hope that it will be useful, | 14 This program is distributed in the hope that it will be useful, |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 | 1018 |
1019 if (bfd_is_section_compressed (abfd, newsect)) | 1019 if (bfd_is_section_compressed (abfd, newsect)) |
1020 { | 1020 { |
1021 /* Compressed section. Check if we should decompress. */ | 1021 /* Compressed section. Check if we should decompress. */ |
1022 if ((abfd->flags & BFD_DECOMPRESS)) | 1022 if ((abfd->flags & BFD_DECOMPRESS)) |
1023 action = decompress; | 1023 action = decompress; |
1024 } | 1024 } |
1025 else | 1025 else |
1026 { | 1026 { |
1027 /* Normal section. Check if we should compress. */ | 1027 /* Normal section. Check if we should compress. */ |
1028 » if ((abfd->flags & BFD_COMPRESS)) | 1028 » if ((abfd->flags & BFD_COMPRESS) && newsect->size != 0) |
1029 action = compress; | 1029 action = compress; |
1030 } | 1030 } |
1031 | 1031 |
1032 new_name = NULL; | 1032 new_name = NULL; |
1033 switch (action) | 1033 switch (action) |
1034 { | 1034 { |
1035 case nothing: | 1035 case nothing: |
1036 break; | 1036 break; |
1037 case compress: | 1037 case compress: |
1038 if (!bfd_init_section_compress_status (abfd, newsect)) | 1038 if (!bfd_init_section_compress_status (abfd, newsect)) |
1039 { | 1039 { |
1040 (*_bfd_error_handler) | 1040 (*_bfd_error_handler) |
1041 » » (_("%B: unable to initialize commpress status for section %s"), | 1041 » » (_("%B: unable to initialize compress status for section %s"), |
1042 abfd, name); | 1042 abfd, name); |
1043 return FALSE; | 1043 return FALSE; |
1044 } | 1044 } |
1045 if (name[1] != 'z') | 1045 if (name[1] != 'z') |
1046 { | 1046 { |
1047 unsigned int len = strlen (name); | 1047 unsigned int len = strlen (name); |
1048 | 1048 |
1049 new_name = bfd_alloc (abfd, len + 2); | 1049 new_name = bfd_alloc (abfd, len + 2); |
1050 if (new_name == NULL) | 1050 if (new_name == NULL) |
1051 return FALSE; | 1051 return FALSE; |
1052 new_name[0] = '.'; | 1052 new_name[0] = '.'; |
1053 new_name[1] = 'z'; | 1053 new_name[1] = 'z'; |
1054 memcpy (new_name + 2, name + 1, len); | 1054 memcpy (new_name + 2, name + 1, len); |
1055 } | 1055 } |
1056 break; | 1056 break; |
1057 case decompress: | 1057 case decompress: |
1058 if (!bfd_init_section_decompress_status (abfd, newsect)) | 1058 if (!bfd_init_section_decompress_status (abfd, newsect)) |
1059 { | 1059 { |
1060 (*_bfd_error_handler) | 1060 (*_bfd_error_handler) |
1061 » » (_("%B: unable to initialize decommpress status for section %s")
, | 1061 » » (_("%B: unable to initialize decompress status for section %s"), |
1062 abfd, name); | 1062 abfd, name); |
1063 return FALSE; | 1063 return FALSE; |
1064 } | 1064 } |
1065 if (name[1] == 'z') | 1065 if (name[1] == 'z') |
1066 { | 1066 { |
1067 unsigned int len = strlen (name); | 1067 unsigned int len = strlen (name); |
1068 | 1068 |
1069 new_name = bfd_alloc (abfd, len); | 1069 new_name = bfd_alloc (abfd, len); |
1070 if (new_name == NULL) | 1070 if (new_name == NULL) |
1071 return FALSE; | 1071 return FALSE; |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 hdr->sh_link = dynsymhdr->sh_link; | 1636 hdr->sh_link = dynsymhdr->sh_link; |
1637 break; | 1637 break; |
1638 } | 1638 } |
1639 } | 1639 } |
1640 } | 1640 } |
1641 } | 1641 } |
1642 break; | 1642 break; |
1643 | 1643 |
1644 case SHT_SYMTAB: /* A symbol table */ | 1644 case SHT_SYMTAB: /* A symbol table */ |
1645 if (elf_onesymtab (abfd) == shindex) | 1645 if (elf_onesymtab (abfd) == shindex) |
error: old chunk mismatch |
None
OLD | NEW |