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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 goto bail; | 137 goto bail; |
138 } | 138 } |
139 | 139 |
140 sym_buf += sc.symoff; | 140 sym_buf += sc.symoff; |
141 str_buf += sc.stroff; | 141 str_buf += sc.stroff; |
142 | 142 |
143 for (j = 0; j < sc.nsyms; j++) { | 143 for (j = 0; j < sc.nsyms; j++) { |
144 /* Location of string is cacluated each time from the | 144 /* Location of string is cacluated each time from the |
145 * start of the string buffer. On darwin the symbols | 145 * start of the string buffer. On darwin the symbols |
146 * are prefixed by "_", so we bump the pointer by 1. | 146 * are prefixed by "_", so we bump the pointer by 1. |
147 * The target value is defined as an int in asm_*_offsets.c, | 147 * The target value is defined as an int in *_asm_*_offsets.c, |
148 * which is 4 bytes on all targets we currently use. | 148 * which is 4 bytes on all targets we currently use. |
149 */ | 149 */ |
150 if (bits == 32) { | 150 if (bits == 32) { |
151 struct nlist nl; | 151 struct nlist nl; |
152 int val; | 152 int val; |
153 | 153 |
154 memcpy(&nl, sym_buf, sizeof(struct nlist)); | 154 memcpy(&nl, sym_buf, sizeof(struct nlist)); |
155 sym_buf += sizeof(struct nlist); | 155 sym_buf += sizeof(struct nlist); |
156 | 156 |
157 memcpy(&val, base_buf + base_data_section + nl.n_value, | 157 memcpy(&val, base_buf + base_data_section + nl.n_value, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); | 440 parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); |
441 | 441 |
442 /* For explanition - refer to _MSC_VER version of code */ | 442 /* For explanition - refer to _MSC_VER version of code */ |
443 strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)
); | 443 strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)
); |
444 /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhd
r.sh_type); */ | 444 /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhd
r.sh_type); */ |
445 | 445 |
446 if (strcmp(section_name, ".bss")) { | 446 if (strcmp(section_name, ".bss")) { |
447 if (sizeof(val) != sym.st_size) { | 447 if (sizeof(val) != sym.st_size) { |
448 /* The target value is declared as an int in | 448 /* The target value is declared as an int in |
449 * asm_*_offsets.c, which is 4 bytes on all | 449 * *_asm_*_offsets.c, which is 4 bytes on all |
450 * targets we currently use. Complain loudly if | 450 * targets we currently use. Complain loudly if |
451 * this is not true. | 451 * this is not true. |
452 */ | 452 */ |
453 log_msg("Symbol size is wrong\n"); | 453 log_msg("Symbol size is wrong\n"); |
454 goto bail; | 454 goto bail; |
455 } | 455 } |
456 | 456 |
457 memcpy(&val, | 457 memcpy(&val, |
458 elf.buf + dhdr.sh_offset + sym.st_value, | 458 elf.buf + dhdr.sh_offset + sym.st_value, |
459 sym.st_size); | 459 sym.st_size); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 521 |
522 parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); | 522 parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); |
523 | 523 |
524 /* For explanition - refer to _MSC_VER version of code */ | 524 /* For explanition - refer to _MSC_VER version of code */ |
525 strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)
); | 525 strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)
); |
526 /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhd
r.sh_type); */ | 526 /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhd
r.sh_type); */ |
527 | 527 |
528 if ((strcmp(section_name, ".bss"))) { | 528 if ((strcmp(section_name, ".bss"))) { |
529 if (sizeof(val) != sym.st_size) { | 529 if (sizeof(val) != sym.st_size) { |
530 /* The target value is declared as an int in | 530 /* The target value is declared as an int in |
531 * asm_*_offsets.c, which is 4 bytes on all | 531 * *_asm_*_offsets.c, which is 4 bytes on all |
532 * targets we currently use. Complain loudly if | 532 * targets we currently use. Complain loudly if |
533 * this is not true. | 533 * this is not true. |
534 */ | 534 */ |
535 log_msg("Symbol size is wrong\n"); | 535 log_msg("Symbol size is wrong\n"); |
536 goto bail; | 536 goto bail; |
537 } | 537 } |
538 | 538 |
539 memcpy(&val, | 539 memcpy(&val, |
540 elf.buf + dhdr.sh_offset + sym.st_value, | 540 elf.buf + dhdr.sh_offset + sym.st_value, |
541 sym.st_size); | 541 sym.st_size); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 #endif | 806 #endif |
807 | 807 |
808 free(file_buf); | 808 free(file_buf); |
809 | 809 |
810 if (!res) | 810 if (!res) |
811 return EXIT_SUCCESS; | 811 return EXIT_SUCCESS; |
812 | 812 |
813 bail: | 813 bail: |
814 return EXIT_FAILURE; | 814 return EXIT_FAILURE; |
815 } | 815 } |
OLD | NEW |