OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 // log_msg("COFF: Parsing section %s\n",sectionname); | 659 // log_msg("COFF: Parsing section %s\n",sectionname); |
660 | 660 |
661 sectionlist[i] = malloc(strlen(sectionname) + 1); | 661 sectionlist[i] = malloc(strlen(sectionname) + 1); |
662 | 662 |
663 if (sectionlist[i] == NULL) { | 663 if (sectionlist[i] == NULL) { |
664 log_msg("Allocating storage for %s failed\n", sectionname); | 664 log_msg("Allocating storage for %s failed\n", sectionname); |
665 goto bail; | 665 goto bail; |
666 } | 666 } |
667 strcpy(sectionlist[i], sectionname); | 667 strcpy(sectionlist[i], sectionname); |
668 | 668 |
669 if (!strcmp(sectionname, ".rdata")) sectionrawdata_ptr = get_le32(ptr + 20); | 669 // check if it's .rdata and is not a COMDAT section. |
| 670 if (!strcmp(sectionname, ".rdata") && |
| 671 (get_le32(ptr + 36) & 0x1000) == 0) { |
| 672 sectionrawdata_ptr = get_le32(ptr + 20); |
| 673 } |
670 | 674 |
671 ptr += 40; | 675 ptr += 40; |
672 } | 676 } |
673 | 677 |
674 // log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); | 678 // log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); |
675 // log_msg("COFF: raw data pointer ofset for section .rdata is %u\n", sectionr
awdata_ptr); | 679 // log_msg("COFF: raw data pointer ofset for section .rdata is %u\n", sectionr
awdata_ptr); |
676 | 680 |
677 /* The compiler puts the data with non-zero offset in .rdata section, but put
s the data with | 681 /* The compiler puts the data with non-zero offset in .rdata section, but put
s the data with |
678 zero offset in .bss section. So, if the data in in .bss section, set offse
t=0. | 682 zero offset in .bss section. So, if the data in in .bss section, set offse
t=0. |
679 Note from Wiki: In an object module compiled from C, the bss section conta
ins | 683 Note from Wiki: In an object module compiled from C, the bss section conta
ins |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 #endif | 836 #endif |
833 | 837 |
834 free(file_buf); | 838 free(file_buf); |
835 | 839 |
836 if (!res) | 840 if (!res) |
837 return EXIT_SUCCESS; | 841 return EXIT_SUCCESS; |
838 | 842 |
839 bail: | 843 bail: |
840 return EXIT_FAILURE; | 844 return EXIT_FAILURE; |
841 } | 845 } |
OLD | NEW |