OLD | NEW |
1 /* | 1 /* |
2 * ELF object format helpers | 2 * ELF object format helpers |
3 * | 3 * |
4 * Copyright (C) 2003-2007 Michael Urman | 4 * Copyright (C) 2003-2007 Michael Urman |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 /* Allocate "special" syms */ | 92 /* Allocate "special" syms */ |
93 elf_ssyms = | 93 elf_ssyms = |
94 yasm_xmalloc(elf_march->num_ssyms * sizeof(yasm_symrec *)); | 94 yasm_xmalloc(elf_march->num_ssyms * sizeof(yasm_symrec *)); |
95 for (i=0; (unsigned int)i<elf_march->num_ssyms; i++) | 95 for (i=0; (unsigned int)i<elf_march->num_ssyms; i++) |
96 { | 96 { |
97 /* FIXME: misuse of NULL bytecode */ | 97 /* FIXME: misuse of NULL bytecode */ |
98 elf_ssyms[i] = yasm_symtab_define_label(symtab, | 98 elf_ssyms[i] = yasm_symtab_define_label(symtab, |
99 elf_march->ssyms[i].name, | 99 elf_march->ssyms[i].name, |
100 NULL, 0, 0); | 100 NULL, 0, 0); |
101 yasm_symrec_add_data(elf_ssyms[i], &elf_ssym_symrec_data, | 101 yasm_symrec_add_data(elf_ssyms[i], &elf_ssym_symrec_data, |
102 &elf_march->ssyms[i]); | 102 (void*)&elf_march->ssyms[i]); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 return elf_march; | 106 return elf_march; |
107 } | 107 } |
108 | 108 |
109 yasm_symrec * | 109 yasm_symrec * |
110 elf_get_special_sym(const char *name, const char *parser) | 110 elf_get_special_sym(const char *name, const char *parser) |
111 { | 111 { |
112 int i; | 112 int i; |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 950 |
951 if (((unsigned)(bufp - buf)) != elf_march->proghead_size) | 951 if (((unsigned)(bufp - buf)) != elf_march->proghead_size) |
952 yasm_internal_error(N_("ELF program header is not proper length")); | 952 yasm_internal_error(N_("ELF program header is not proper length")); |
953 | 953 |
954 if (fwrite(buf, elf_march->proghead_size, 1, f)) | 954 if (fwrite(buf, elf_march->proghead_size, 1, f)) |
955 return elf_march->proghead_size; | 955 return elf_march->proghead_size; |
956 | 956 |
957 yasm_internal_error(N_("Failed to write ELF program header")); | 957 yasm_internal_error(N_("Failed to write ELF program header")); |
958 return 0; | 958 return 0; |
959 } | 959 } |
OLD | NEW |