OLD | NEW |
1 /* | 1 /* |
2 * COFF (DJGPP) object format | 2 * COFF (DJGPP) object format |
3 * | 3 * |
4 * Copyright (C) 2002-2007 Peter Johnson | 4 * Copyright (C) 2002-2007 Peter Johnson |
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. |
11 * 2. Redistributions in binary form must reproduce the above copyright | 11 * 2. Redistributions in binary form must reproduce the above copyright |
12 * notice, this list of conditions and the following disclaimer in the | 12 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the distribution. | 13 * documentation and/or other materials provided with the distribution. |
14 * | 14 * |
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' | 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' |
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE | 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE |
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * POSSIBILITY OF SUCH DAMAGE. | 25 * POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 #include <util.h> | 27 #include <util.h> |
28 #include <time.h> | 28 #include <time.h> |
29 /*@unused@*/ RCSID("$Id: coff-objfmt.c 2166 2009-01-02 08:33:21Z peter $"); | 29 /*@unused@*/ RCSID("$Id: coff-objfmt.c 2347 2010-08-01 17:31:12Z peter $"); |
30 | 30 |
31 #include <libyasm.h> | 31 #include <libyasm.h> |
32 | 32 |
33 #include "coff-objfmt.h" | 33 #include "coff-objfmt.h" |
34 | 34 |
35 | 35 |
36 #define REGULAR_OUTBUF_SIZE 1024 | 36 #define REGULAR_OUTBUF_SIZE 1024 |
37 | 37 |
38 /* Defining this to 0 sets all section VMA's to 0 rather than as the same as | 38 /* Defining this to 0 sets all section VMA's to 0 rather than as the same as |
39 * the LMA. According to the DJGPP COFF Spec, this should be set to 1 | 39 * the LMA. According to the DJGPP COFF Spec, this should be set to 1 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 /*@owned@*/ char *fname; /* filename aux entry */ | 155 /*@owned@*/ char *fname; /* filename aux entry */ |
156 } coff_symtab_auxent; | 156 } coff_symtab_auxent; |
157 | 157 |
158 typedef enum coff_symtab_auxtype { | 158 typedef enum coff_symtab_auxtype { |
159 COFF_SYMTAB_AUX_NONE = 0, | 159 COFF_SYMTAB_AUX_NONE = 0, |
160 COFF_SYMTAB_AUX_SECT, | 160 COFF_SYMTAB_AUX_SECT, |
161 COFF_SYMTAB_AUX_FILE | 161 COFF_SYMTAB_AUX_FILE |
162 } coff_symtab_auxtype; | 162 } coff_symtab_auxtype; |
163 | 163 |
164 typedef struct coff_symrec_data { | 164 typedef struct coff_symrec_data { |
| 165 int forcevis; /* force visibility in symbol table */ |
165 unsigned long index; /* assigned COFF symbol table index */ | 166 unsigned long index; /* assigned COFF symbol table index */ |
| 167 unsigned int type; /* type */ |
166 coff_symrec_sclass sclass; /* storage class */ | 168 coff_symrec_sclass sclass; /* storage class */ |
167 | 169 |
168 int numaux; /* number of auxiliary entries */ | 170 int numaux; /* number of auxiliary entries */ |
169 coff_symtab_auxtype auxtype; /* type of aux entries */ | 171 coff_symtab_auxtype auxtype; /* type of aux entries */ |
170 coff_symtab_auxent aux[1]; /* actually may be any size (including 0) */ | 172 coff_symtab_auxent aux[1]; /* actually may be any size (including 0) */ |
171 } coff_symrec_data; | 173 } coff_symrec_data; |
172 | 174 |
173 typedef struct yasm_objfmt_coff { | 175 typedef struct yasm_objfmt_coff { |
174 yasm_objfmt_base objfmt; /* base structure */ | 176 yasm_objfmt_base objfmt; /* base structure */ |
175 | 177 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 249 |
248 | 250 |
249 static /*@dependent@*/ coff_symrec_data * | 251 static /*@dependent@*/ coff_symrec_data * |
250 coff_objfmt_sym_set_data(yasm_symrec *sym, coff_symrec_sclass sclass, | 252 coff_objfmt_sym_set_data(yasm_symrec *sym, coff_symrec_sclass sclass, |
251 int numaux, coff_symtab_auxtype auxtype) | 253 int numaux, coff_symtab_auxtype auxtype) |
252 { | 254 { |
253 coff_symrec_data *sym_data; | 255 coff_symrec_data *sym_data; |
254 | 256 |
255 sym_data = yasm_xmalloc(sizeof(coff_symrec_data) + | 257 sym_data = yasm_xmalloc(sizeof(coff_symrec_data) + |
256 (numaux-1)*sizeof(coff_symtab_auxent)); | 258 (numaux-1)*sizeof(coff_symtab_auxent)); |
| 259 sym_data->forcevis = 0; |
257 sym_data->index = 0; | 260 sym_data->index = 0; |
| 261 sym_data->type = 0; |
258 sym_data->sclass = sclass; | 262 sym_data->sclass = sclass; |
259 sym_data->numaux = numaux; | 263 sym_data->numaux = numaux; |
260 sym_data->auxtype = auxtype; | 264 sym_data->auxtype = auxtype; |
261 | 265 |
262 yasm_symrec_add_data(sym, &coff_symrec_data_cb, sym_data); | 266 yasm_symrec_add_data(sym, &coff_symrec_data_cb, sym_data); |
263 | 267 |
264 return sym_data; | 268 return sym_data; |
265 } | 269 } |
266 | 270 |
267 static yasm_objfmt_coff * | 271 static yasm_objfmt_coff * |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 "amd64") == 0) { | 340 "amd64") == 0) { |
337 objfmt_coff->machine = COFF_MACHINE_AMD64; | 341 objfmt_coff->machine = COFF_MACHINE_AMD64; |
338 objfmt_coff->objfmt.module = &yasm_win64_LTX_objfmt; | 342 objfmt_coff->objfmt.module = &yasm_win64_LTX_objfmt; |
339 objfmt_coff->win64 = 1; | 343 objfmt_coff->win64 = 1; |
340 } else { | 344 } else { |
341 yasm_xfree(objfmt_coff); | 345 yasm_xfree(objfmt_coff); |
342 return NULL; | 346 return NULL; |
343 } | 347 } |
344 | 348 |
345 objfmt_coff->win32 = 1; | 349 objfmt_coff->win32 = 1; |
| 350 /* Define a @feat.00 symbol for win32 safeseh handling */ |
| 351 if (!objfmt_coff->win64) { |
| 352 yasm_symrec *feat00; |
| 353 coff_symrec_data *sym_data; |
| 354 feat00 = yasm_symtab_define_equ(object->symtab, "@feat.00", |
| 355 yasm_expr_create_ident(yasm_expr_int( |
| 356 yasm_intnum_create_uint(1)), 0), 0); |
| 357 sym_data = coff_objfmt_sym_set_data(feat00, COFF_SCL_STAT, 0, |
| 358 COFF_SYMTAB_AUX_NONE); |
| 359 sym_data->forcevis = 1; |
| 360 } |
346 } | 361 } |
347 return (yasm_objfmt *)objfmt_coff; | 362 return (yasm_objfmt *)objfmt_coff; |
348 } | 363 } |
349 | 364 |
350 static yasm_objfmt * | 365 static yasm_objfmt * |
351 win64_objfmt_create(yasm_object *object) | 366 win64_objfmt_create(yasm_object *object) |
352 { | 367 { |
353 yasm_objfmt_coff *objfmt_coff = coff_common_create(object); | 368 yasm_objfmt_coff *objfmt_coff = coff_common_create(object); |
354 | 369 |
355 if (objfmt_coff) { | 370 if (objfmt_coff) { |
356 /* Support amd64 machine of x86 arch */ | 371 /* Support amd64 machine of x86 arch */ |
357 if (yasm__strcasecmp(yasm_arch_get_machine(object->arch), | 372 if (yasm__strcasecmp(yasm_arch_get_machine(object->arch), |
358 "amd64") == 0) { | 373 "amd64") == 0) { |
359 objfmt_coff->machine = COFF_MACHINE_AMD64; | 374 objfmt_coff->machine = COFF_MACHINE_AMD64; |
360 } else { | 375 } else { |
361 yasm_xfree(objfmt_coff); | 376 yasm_xfree(objfmt_coff); |
362 return NULL; | 377 return NULL; |
363 } | 378 } |
364 | 379 |
365 objfmt_coff->objfmt.module = &yasm_win64_LTX_objfmt; | 380 objfmt_coff->objfmt.module = &yasm_win64_LTX_objfmt; |
366 objfmt_coff->win32 = 1; | 381 objfmt_coff->win32 = 1; |
367 objfmt_coff->win64 = 1; | 382 objfmt_coff->win64 = 1; |
368 } | 383 } |
369 return (yasm_objfmt *)objfmt_coff; | 384 return (yasm_objfmt *)objfmt_coff; |
370 } | 385 } |
371 | 386 |
372 static coff_section_data * | 387 static void |
373 coff_objfmt_init_new_section(yasm_object *object, yasm_section *sect, | 388 coff_objfmt_init_new_section(yasm_section *sect, unsigned long line) |
374 const char *sectname, unsigned long line) | |
375 { | 389 { |
| 390 yasm_object *object = yasm_section_get_object(sect); |
| 391 const char *sectname = yasm_section_get_name(sect); |
376 yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; | 392 yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; |
377 coff_section_data *data; | 393 coff_section_data *data; |
378 yasm_symrec *sym; | 394 yasm_symrec *sym; |
379 | 395 |
380 data = yasm_xmalloc(sizeof(coff_section_data)); | 396 data = yasm_xmalloc(sizeof(coff_section_data)); |
381 data->scnum = objfmt_coff->parse_scnum++; | 397 data->scnum = objfmt_coff->parse_scnum++; |
382 data->flags = 0; | 398 data->flags = 0; |
383 data->addr = 0; | 399 data->addr = 0; |
384 data->scnptr = 0; | 400 data->scnptr = 0; |
385 data->size = 0; | 401 data->size = 0; |
386 data->relptr = 0; | 402 data->relptr = 0; |
387 data->nreloc = 0; | 403 data->nreloc = 0; |
388 data->flags2 = 0; | 404 data->flags2 = 0; |
389 data->strtab_name = 0; | 405 data->strtab_name = 0; |
390 data->isdebug = 0; | 406 data->isdebug = 0; |
| 407 |
| 408 if (yasm__strncasecmp(sectname, ".debug", 6)==0) { |
| 409 data->flags = COFF_STYP_DATA; |
| 410 if (objfmt_coff->win32) |
| 411 data->flags |= COFF_STYP_DISCARD|COFF_STYP_READ; |
| 412 data->isdebug = 1; |
| 413 } else |
| 414 data->flags = COFF_STYP_TEXT; |
| 415 |
391 yasm_section_add_data(sect, &coff_section_data_cb, data); | 416 yasm_section_add_data(sect, &coff_section_data_cb, data); |
392 | 417 |
393 sym = yasm_symtab_define_label(object->symtab, sectname, | 418 sym = yasm_symtab_define_label(object->symtab, sectname, |
394 yasm_section_bcs_first(sect), 1, line); | 419 yasm_section_bcs_first(sect), 1, line); |
395 yasm_symrec_declare(sym, YASM_SYM_GLOBAL, line); | 420 yasm_symrec_declare(sym, YASM_SYM_GLOBAL, line); |
396 coff_objfmt_sym_set_data(sym, COFF_SCL_STAT, 1, COFF_SYMTAB_AUX_SECT); | 421 coff_objfmt_sym_set_data(sym, COFF_SCL_STAT, 1, COFF_SYMTAB_AUX_SECT); |
397 data->sym = sym; | 422 data->sym = sym; |
398 return data; | |
399 } | |
400 | |
401 static int | |
402 coff_objfmt_init_remaining_section(yasm_section *sect, /*@null@*/ void *d) | |
403 { | |
404 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; | |
405 /*@dependent@*/ /*@null@*/ coff_section_data *csd; | |
406 | |
407 assert(info != NULL); | |
408 csd = yasm_section_get_data(sect, &coff_section_data_cb); | |
409 if (!csd) { | |
410 /* Initialize new one */ | |
411 const char *sectname = yasm_section_get_name(sect); | |
412 csd = coff_objfmt_init_new_section(info->object, sect, sectname, 0); | |
413 if (yasm__strncasecmp(sectname, ".debug", 6)==0) { | |
414 csd->flags = COFF_STYP_DATA; | |
415 if (info->objfmt_coff->win32) | |
416 csd->flags |= COFF_STYP_DISCARD|COFF_STYP_READ; | |
417 csd->isdebug = 1; | |
418 } else | |
419 csd->flags = COFF_STYP_TEXT; | |
420 } | |
421 | |
422 return 0; | |
423 } | 423 } |
424 | 424 |
425 static int | 425 static int |
426 coff_objfmt_set_section_addr(yasm_section *sect, /*@null@*/ void *d) | 426 coff_objfmt_set_section_addr(yasm_section *sect, /*@null@*/ void *d) |
427 { | 427 { |
428 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; | 428 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; |
429 /*@dependent@*/ /*@null@*/ coff_section_data *csd; | 429 /*@dependent@*/ /*@null@*/ coff_section_data *csd; |
430 | 430 |
431 assert(info != NULL); | 431 assert(info != NULL); |
432 csd = yasm_section_get_data(sect, &coff_section_data_cb); | 432 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 /*@notreached@*/ | 786 /*@notreached@*/ |
787 return 1; | 787 return 1; |
788 } | 788 } |
789 | 789 |
790 info->sect = sect; | 790 info->sect = sect; |
791 info->csd = csd; | 791 info->csd = csd; |
792 yasm_section_bcs_traverse(sect, info->errwarns, info, | 792 yasm_section_bcs_traverse(sect, info->errwarns, info, |
793 coff_objfmt_output_bytecode); | 793 coff_objfmt_output_bytecode); |
794 | 794 |
795 /* Sanity check final section size */ | 795 /* Sanity check final section size */ |
796 if (csd->size != yasm_bc_next_offset(yasm_section_bcs_last(sect))) | 796 if (yasm_errwarns_num_errors(info->errwarns, 0) == 0 && |
| 797 csd->size != yasm_bc_next_offset(yasm_section_bcs_last(sect))) |
797 yasm_internal_error( | 798 yasm_internal_error( |
798 N_("coff: section computed size did not match actual size")); | 799 N_("coff: section computed size did not match actual size")); |
799 } | 800 } |
800 | 801 |
801 /* Empty? Go on to next section */ | 802 /* Empty? Go on to next section */ |
802 if (csd->size == 0) | 803 if (csd->size == 0) |
803 return 0; | 804 return 0; |
804 | 805 |
805 if (!csd->isdebug) | 806 if (!csd->isdebug) |
806 info->addr += csd->size; | 807 info->addr += csd->size; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 static int | 941 static int |
941 coff_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) | 942 coff_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) |
942 { | 943 { |
943 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; | 944 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; |
944 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); | 945 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); |
945 coff_symrec_data *sym_data; | 946 coff_symrec_data *sym_data; |
946 | 947 |
947 assert(info != NULL); | 948 assert(info != NULL); |
948 | 949 |
949 sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); | 950 sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); |
950 if ((vis & (YASM_SYM_EXTERN|YASM_SYM_GLOBAL|YASM_SYM_COMMON)) && !sym_data) | |
951 sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_EXT, 0, | |
952 COFF_SYMTAB_AUX_NONE); | |
953 | 951 |
954 if (info->all_syms || vis != YASM_SYM_LOCAL || yasm_symrec_is_abs(sym)) { | 952 if (info->all_syms || vis != YASM_SYM_LOCAL || yasm_symrec_is_abs(sym) || |
| 953 (sym_data && sym_data->forcevis)) { |
955 /* Save index in symrec data */ | 954 /* Save index in symrec data */ |
956 if (!sym_data) { | 955 if (!sym_data) |
957 sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_STAT, 0, | 956 sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_NULL, 0, |
958 COFF_SYMTAB_AUX_NONE); | 957 COFF_SYMTAB_AUX_NONE); |
| 958 /* Set storage class based on visibility if not already set */ |
| 959 if (sym_data->sclass == COFF_SCL_NULL) { |
| 960 if (vis & (YASM_SYM_EXTERN|YASM_SYM_GLOBAL|YASM_SYM_COMMON)) |
| 961 sym_data->sclass = COFF_SCL_EXT; |
| 962 else |
| 963 sym_data->sclass = COFF_SCL_STAT; |
959 } | 964 } |
| 965 |
960 sym_data->index = info->indx; | 966 sym_data->index = info->indx; |
961 | 967 |
962 info->indx += sym_data->numaux + 1; | 968 info->indx += sym_data->numaux + 1; |
963 } | 969 } |
964 return 0; | 970 return 0; |
965 } | 971 } |
966 | 972 |
967 static int | 973 static int |
968 coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) | 974 coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) |
969 { | 975 { |
970 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; | 976 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; |
971 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); | 977 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); |
972 int is_abs = yasm_symrec_is_abs(sym); | 978 int is_abs = yasm_symrec_is_abs(sym); |
| 979 /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; |
| 980 csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); |
973 | 981 |
974 assert(info != NULL); | 982 assert(info != NULL); |
975 | 983 |
976 /* Don't output local syms unless outputting all syms */ | 984 /* Don't output local syms unless outputting all syms */ |
977 if (info->all_syms || vis != YASM_SYM_LOCAL || is_abs) { | 985 if (info->all_syms || vis != YASM_SYM_LOCAL || is_abs || |
| 986 (csymd && csymd->forcevis)) { |
978 /*@only*/ char *name; | 987 /*@only*/ char *name; |
979 const yasm_expr *equ_val; | 988 const yasm_expr *equ_val; |
980 const yasm_intnum *intn; | 989 const yasm_intnum *intn; |
981 unsigned char *localbuf; | 990 unsigned char *localbuf; |
982 size_t len; | 991 size_t len; |
983 int aux; | 992 int aux; |
984 /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; | |
985 unsigned long value = 0; | 993 unsigned long value = 0; |
986 unsigned int scnum = 0xfffe; /* -2 = debugging symbol */ | 994 unsigned int scnum = 0xfffe; /* -2 = debugging symbol */ |
987 /*@dependent@*/ /*@null@*/ yasm_section *sect; | 995 /*@dependent@*/ /*@null@*/ yasm_section *sect; |
988 /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; | 996 /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; |
989 unsigned long scnlen = 0; /* for sect auxent */ | 997 unsigned long scnlen = 0; /* for sect auxent */ |
990 unsigned long nreloc = 0; /* for sect auxent */ | 998 unsigned long nreloc = 0; /* for sect auxent */ |
991 yasm_objfmt_coff *objfmt_coff = info->objfmt_coff; | 999 yasm_objfmt_coff *objfmt_coff = info->objfmt_coff; |
992 | 1000 |
993 if (is_abs) | 1001 if (is_abs) |
994 name = yasm__xstrdup(".absolut"); | 1002 name = yasm__xstrdup(".absolut"); |
995 else | 1003 else |
996 name = yasm_symrec_get_global_name(sym, info->object); | 1004 name = yasm_symrec_get_global_name(sym, info->object); |
997 len = strlen(name); | 1005 len = strlen(name); |
998 | 1006 |
999 /* Get symrec's of_data (needed for storage class) */ | 1007 /* Get symrec's of_data (needed for storage class) */ |
1000 csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); | |
1001 if (!csymd) | 1008 if (!csymd) |
1002 yasm_internal_error(N_("coff: expected sym data to be present")); | 1009 yasm_internal_error(N_("coff: expected sym data to be present")); |
1003 | 1010 |
1004 /* Look at symrec for value/scnum/etc. */ | 1011 /* Look at symrec for value/scnum/etc. */ |
1005 if (yasm_symrec_get_label(sym, &precbc)) { | 1012 if (yasm_symrec_get_label(sym, &precbc)) { |
1006 if (precbc) | 1013 if (precbc) |
1007 sect = yasm_bc_get_section(precbc); | 1014 sect = yasm_bc_get_section(precbc); |
1008 else | 1015 else |
1009 sect = NULL; | 1016 sect = NULL; |
1010 /* it's a label: get value and offset. | 1017 /* it's a label: get value and offset. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 YASM_WRITE_32_L(localbuf, 0); /* "zeros" field */ | 1069 YASM_WRITE_32_L(localbuf, 0); /* "zeros" field */ |
1063 YASM_WRITE_32_L(localbuf, info->strtab_offset); /* strtab offset */ | 1070 YASM_WRITE_32_L(localbuf, info->strtab_offset); /* strtab offset */ |
1064 info->strtab_offset += (unsigned long)(len+1); | 1071 info->strtab_offset += (unsigned long)(len+1); |
1065 } else { | 1072 } else { |
1066 /* <8 chars, so no string table entry needed */ | 1073 /* <8 chars, so no string table entry needed */ |
1067 strncpy((char *)localbuf, name, 8); | 1074 strncpy((char *)localbuf, name, 8); |
1068 localbuf += 8; | 1075 localbuf += 8; |
1069 } | 1076 } |
1070 YASM_WRITE_32_L(localbuf, value); /* value */ | 1077 YASM_WRITE_32_L(localbuf, value); /* value */ |
1071 YASM_WRITE_16_L(localbuf, scnum); /* section number */ | 1078 YASM_WRITE_16_L(localbuf, scnum); /* section number */ |
1072 YASM_WRITE_16_L(localbuf, 0); /* type is always zero (for now) */ | 1079 YASM_WRITE_16_L(localbuf, csymd->type); /* type */ |
1073 YASM_WRITE_8(localbuf, csymd->sclass); /* storage class */ | 1080 YASM_WRITE_8(localbuf, csymd->sclass); /* storage class */ |
1074 YASM_WRITE_8(localbuf, csymd->numaux); /* number of aux entries */ | 1081 YASM_WRITE_8(localbuf, csymd->numaux); /* number of aux entries */ |
1075 fwrite(info->buf, 18, 1, info->f); | 1082 fwrite(info->buf, 18, 1, info->f); |
1076 for (aux=0; aux<csymd->numaux; aux++) { | 1083 for (aux=0; aux<csymd->numaux; aux++) { |
1077 localbuf = info->buf; | 1084 localbuf = info->buf; |
1078 memset(localbuf, 0, 18); | 1085 memset(localbuf, 0, 18); |
1079 switch (csymd->auxtype) { | 1086 switch (csymd->auxtype) { |
1080 case COFF_SYMTAB_AUX_NONE: | 1087 case COFF_SYMTAB_AUX_NONE: |
1081 break; | 1088 break; |
1082 case COFF_SYMTAB_AUX_SECT: | 1089 case COFF_SYMTAB_AUX_SECT: |
(...skipping 19 matching lines...) Expand all Loading... |
1102 yasm_xfree(name); | 1109 yasm_xfree(name); |
1103 } | 1110 } |
1104 return 0; | 1111 return 0; |
1105 } | 1112 } |
1106 | 1113 |
1107 static int | 1114 static int |
1108 coff_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) | 1115 coff_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) |
1109 { | 1116 { |
1110 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; | 1117 /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; |
1111 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); | 1118 yasm_sym_vis vis = yasm_symrec_get_visibility(sym); |
| 1119 /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; |
| 1120 csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); |
1112 | 1121 |
1113 assert(info != NULL); | 1122 assert(info != NULL); |
1114 | 1123 |
1115 /* Don't output local syms unless outputting all syms */ | 1124 /* Don't output local syms unless outputting all syms */ |
1116 if (info->all_syms || vis != YASM_SYM_LOCAL) { | 1125 if (info->all_syms || vis != YASM_SYM_LOCAL || |
| 1126 (csymd && csymd->forcevis)) { |
1117 /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); | 1127 /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); |
1118 /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; | |
1119 size_t len = strlen(name); | 1128 size_t len = strlen(name); |
1120 int aux; | 1129 int aux; |
1121 | 1130 |
1122 csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); | |
1123 if (!csymd) | 1131 if (!csymd) |
1124 yasm_internal_error(N_("coff: expected sym data to be present")); | 1132 yasm_internal_error(N_("coff: expected sym data to be present")); |
1125 | 1133 |
1126 if (len > 8) | 1134 if (len > 8) |
1127 fwrite(name, len+1, 1, info->f); | 1135 fwrite(name, len+1, 1, info->f); |
1128 for (aux=0; aux<csymd->numaux; aux++) { | 1136 for (aux=0; aux<csymd->numaux; aux++) { |
1129 switch (csymd->auxtype) { | 1137 switch (csymd->auxtype) { |
1130 case COFF_SYMTAB_AUX_FILE: | 1138 case COFF_SYMTAB_AUX_FILE: |
1131 len = strlen(csymd->aux[0].fname); | 1139 len = strlen(csymd->aux[0].fname); |
1132 if (len > 14) | 1140 if (len > 14) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 */ | 1182 */ |
1175 all_syms |= objfmt_coff->win64; | 1183 all_syms |= objfmt_coff->win64; |
1176 | 1184 |
1177 info.strtab_offset = 4; | 1185 info.strtab_offset = 4; |
1178 info.object = object; | 1186 info.object = object; |
1179 info.objfmt_coff = objfmt_coff; | 1187 info.objfmt_coff = objfmt_coff; |
1180 info.errwarns = errwarns; | 1188 info.errwarns = errwarns; |
1181 info.f = f; | 1189 info.f = f; |
1182 info.buf = yasm_xmalloc(REGULAR_OUTBUF_SIZE); | 1190 info.buf = yasm_xmalloc(REGULAR_OUTBUF_SIZE); |
1183 | 1191 |
1184 /* Initialize section data (and count in parse_scnum) any sections that | |
1185 * we've not initialized so far. | |
1186 */ | |
1187 yasm_object_sections_traverse(object, &info, | |
1188 coff_objfmt_init_remaining_section); | |
1189 | |
1190 /* Allocate space for headers by seeking forward */ | 1192 /* Allocate space for headers by seeking forward */ |
1191 if (fseek(f, (long)(20+40*(objfmt_coff->parse_scnum-1)), SEEK_SET) < 0) { | 1193 if (fseek(f, (long)(20+40*(objfmt_coff->parse_scnum-1)), SEEK_SET) < 0) { |
1192 yasm__fatal(N_("could not seek on output file")); | 1194 yasm__fatal(N_("could not seek on output file")); |
1193 /*@notreached@*/ | 1195 /*@notreached@*/ |
1194 return; | 1196 return; |
1195 } | 1197 } |
1196 | 1198 |
1197 /* Finalize symbol table (assign index to each symbol) */ | 1199 /* Finalize symbol table (assign index to each symbol) */ |
1198 info.indx = 0; | 1200 info.indx = 0; |
1199 info.all_syms = all_syms; | 1201 info.all_syms = all_syms; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 static yasm_section * | 1282 static yasm_section * |
1281 coff_objfmt_add_default_section(yasm_object *object) | 1283 coff_objfmt_add_default_section(yasm_object *object) |
1282 { | 1284 { |
1283 yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; | 1285 yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; |
1284 yasm_section *retval; | 1286 yasm_section *retval; |
1285 coff_section_data *csd; | 1287 coff_section_data *csd; |
1286 int isnew; | 1288 int isnew; |
1287 | 1289 |
1288 retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); | 1290 retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); |
1289 if (isnew) { | 1291 if (isnew) { |
1290 csd = coff_objfmt_init_new_section(object, retval, ".text", 0); | 1292 csd = yasm_section_get_data(retval, &coff_section_data_cb); |
1291 csd->flags = COFF_STYP_TEXT; | 1293 csd->flags = COFF_STYP_TEXT; |
1292 if (objfmt_coff->win32) | 1294 if (objfmt_coff->win32) |
1293 csd->flags |= COFF_STYP_EXECUTE | COFF_STYP_READ; | 1295 csd->flags |= COFF_STYP_EXECUTE | COFF_STYP_READ; |
1294 yasm_section_set_default(retval, 1); | 1296 yasm_section_set_default(retval, 1); |
1295 } | 1297 } |
1296 return retval; | 1298 return retval; |
1297 } | 1299 } |
1298 | 1300 |
1299 struct coff_section_switch_data { | 1301 struct coff_section_switch_data { |
1300 int isdefault; | 1302 int isdefault; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 * files via "/nnnn" (where nnnn is decimal offset into string table), | 1565 * files via "/nnnn" (where nnnn is decimal offset into string table), |
1564 * so only warn for regular COFF. | 1566 * so only warn for regular COFF. |
1565 */ | 1567 */ |
1566 yasm_warn_set(YASM_WARN_GENERAL, | 1568 yasm_warn_set(YASM_WARN_GENERAL, |
1567 N_("COFF section names limited to 8 characters: truncating")); | 1569 N_("COFF section names limited to 8 characters: truncating")); |
1568 realname[8] = '\0'; | 1570 realname[8] = '\0'; |
1569 } | 1571 } |
1570 | 1572 |
1571 retval = yasm_object_get_general(object, realname, align, iscode, | 1573 retval = yasm_object_get_general(object, realname, align, iscode, |
1572 resonly, &isnew, line); | 1574 resonly, &isnew, line); |
| 1575 yasm_xfree(realname); |
1573 | 1576 |
1574 if (isnew) | 1577 csd = yasm_section_get_data(retval, &coff_section_data_cb); |
1575 csd = coff_objfmt_init_new_section(object, retval, realname, line); | |
1576 else | |
1577 csd = yasm_section_get_data(retval, &coff_section_data_cb); | |
1578 | |
1579 yasm_xfree(realname); | |
1580 | 1578 |
1581 if (isnew || yasm_section_is_default(retval)) { | 1579 if (isnew || yasm_section_is_default(retval)) { |
1582 yasm_section_set_default(retval, 0); | 1580 yasm_section_set_default(retval, 0); |
1583 csd->flags = data.flags; | 1581 csd->flags = data.flags; |
1584 csd->flags2 = data.flags2; | 1582 csd->flags2 = data.flags2; |
1585 yasm_section_set_align(retval, align, line); | 1583 yasm_section_set_align(retval, align, line); |
1586 } else if (flags_override && !data.gasflags) | 1584 } else if (flags_override && !data.gasflags) |
1587 yasm_warn_set(YASM_WARN_GENERAL, | 1585 yasm_warn_set(YASM_WARN_GENERAL, |
1588 N_("section flags ignored on section redeclaration")); | 1586 N_("section flags ignored on section redeclaration")); |
1589 return retval; | 1587 return retval; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 N_("argument to EXPORT must be symbol name")); | 1666 N_("argument to EXPORT must be symbol name")); |
1669 return; | 1667 return; |
1670 } | 1668 } |
1671 | 1669 |
1672 /* Add to end of linker directives */ | 1670 /* Add to end of linker directives */ |
1673 sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, &isnew, line); | 1671 sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, &isnew, line); |
1674 | 1672 |
1675 /* Initialize directive section if needed */ | 1673 /* Initialize directive section if needed */ |
1676 if (isnew) { | 1674 if (isnew) { |
1677 coff_section_data *csd; | 1675 coff_section_data *csd; |
1678 csd = coff_objfmt_init_new_section(object, sect, | 1676 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
1679 yasm_section_get_name(sect), line); | |
1680 csd->flags = COFF_STYP_INFO | COFF_STYP_DISCARD | COFF_STYP_READ; | 1677 csd->flags = COFF_STYP_INFO | COFF_STYP_DISCARD | COFF_STYP_READ; |
1681 } | 1678 } |
1682 | 1679 |
1683 /* Add text as data bytecode */ | 1680 /* Add text as data bytecode */ |
1684 yasm_dvs_initialize(&dvs); | 1681 yasm_dvs_initialize(&dvs); |
1685 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup("-export:"), | 1682 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup("-export:"), |
1686 strlen("-export:"))); | 1683 strlen("-export:"))); |
1687 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup(symname), | 1684 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup(symname), |
1688 strlen(symname))); | 1685 strlen(symname))); |
1689 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup(" "), 1)); | 1686 yasm_dvs_append(&dvs, yasm_dv_create_string(yasm__xstrdup(" "), 1)); |
1690 yasm_section_bcs_append(sect, yasm_bc_create_data(&dvs, 1, 0, NULL, line)); | 1687 yasm_section_bcs_append(sect, yasm_bc_create_data(&dvs, 1, 0, NULL, line)); |
1691 } | 1688 } |
1692 | 1689 |
1693 static void | 1690 static void |
1694 dir_safeseh(yasm_object *object, yasm_valparamhead *valparams, | 1691 dir_safeseh(yasm_object *object, yasm_valparamhead *valparams, |
1695 yasm_valparamhead *objext_valparams, unsigned long line) | 1692 yasm_valparamhead *objext_valparams, unsigned long line) |
1696 { | 1693 { |
1697 yasm_valparam *vp; | 1694 yasm_valparam *vp; |
1698 /*@null@*/ const char *symname; | 1695 /*@null@*/ const char *symname; |
1699 yasm_symrec *sym; | 1696 yasm_symrec *sym; |
1700 int isnew; | 1697 int isnew; |
1701 yasm_section *sect; | 1698 yasm_section *sect; |
1702 | 1699 |
1703 /* Reference symbol (to generate error if not declared). | 1700 /* Reference symbol (to generate error if not declared). |
1704 * Also, symbol must be externally visible, so force global. | 1701 * Also, symbol must be externally visible, so force it. |
1705 */ | 1702 */ |
1706 vp = yasm_vps_first(valparams); | 1703 vp = yasm_vps_first(valparams); |
1707 symname = yasm_vp_id(vp); | 1704 symname = yasm_vp_id(vp); |
1708 if (symname) { | 1705 if (symname) { |
| 1706 coff_symrec_data *sym_data; |
1709 sym = yasm_symtab_use(object->symtab, symname, line); | 1707 sym = yasm_symtab_use(object->symtab, symname, line); |
1710 yasm_symrec_declare(sym, YASM_SYM_GLOBAL, line); | 1708 sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); |
| 1709 if (!sym_data) { |
| 1710 sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_NULL, 0, |
| 1711 COFF_SYMTAB_AUX_NONE); |
| 1712 } |
| 1713 sym_data->forcevis = 1; |
| 1714 sym_data->type = 0x20; /* function */ |
1711 } else { | 1715 } else { |
1712 yasm_error_set(YASM_ERROR_SYNTAX, | 1716 yasm_error_set(YASM_ERROR_SYNTAX, |
1713 N_("argument to SAFESEH must be symbol name")); | 1717 N_("argument to SAFESEH must be symbol name")); |
1714 return; | 1718 return; |
1715 } | 1719 } |
1716 | 1720 |
1717 /* | 1721 /* |
1718 * Add symbol number to end of .sxdata section. | 1722 * Add symbol number to end of .sxdata section. |
1719 */ | 1723 */ |
1720 | 1724 |
1721 sect = yasm_object_get_general(object, ".sxdata", 0, 0, 0, &isnew, line); | 1725 sect = yasm_object_get_general(object, ".sxdata", 0, 0, 0, &isnew, line); |
1722 | 1726 |
1723 /* Initialize sxdata section if needed */ | 1727 /* Initialize sxdata section if needed */ |
1724 if (isnew) { | 1728 if (isnew) { |
1725 coff_section_data *csd; | 1729 coff_section_data *csd; |
1726 csd = coff_objfmt_init_new_section(object, sect, ".sxdata", line); | 1730 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
1727 csd->flags = COFF_STYP_INFO; | 1731 csd->flags = COFF_STYP_INFO; |
1728 } | 1732 } |
1729 | 1733 |
1730 /* Add as sxdata bytecode */ | 1734 /* Add as sxdata bytecode */ |
1731 yasm_section_bcs_append(sect, | 1735 yasm_section_bcs_append(sect, |
1732 yasm_bc_create_common(&win32_sxdata_bc_callback, | 1736 yasm_bc_create_common(&win32_sxdata_bc_callback, |
1733 sym, line)); | 1737 sym, line)); |
1734 } | 1738 } |
1735 | 1739 |
1736 static void | 1740 static void |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 curpos = get_curpos(object, "ENDPROC_FRAME", line); | 2130 curpos = get_curpos(object, "ENDPROC_FRAME", line); |
2127 | 2131 |
2128 /* | 2132 /* |
2129 * Add unwind info to end of .xdata section. | 2133 * Add unwind info to end of .xdata section. |
2130 */ | 2134 */ |
2131 | 2135 |
2132 sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, &isnew, line); | 2136 sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, &isnew, line); |
2133 | 2137 |
2134 /* Initialize xdata section if needed */ | 2138 /* Initialize xdata section if needed */ |
2135 if (isnew) { | 2139 if (isnew) { |
2136 csd = coff_objfmt_init_new_section(object, sect, ".xdata", line); | 2140 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
2137 csd->flags = COFF_STYP_DATA | COFF_STYP_READ; | 2141 csd->flags = COFF_STYP_DATA | COFF_STYP_READ; |
2138 yasm_section_set_align(sect, 8, line); | 2142 yasm_section_set_align(sect, 8, line); |
2139 } | 2143 } |
2140 | 2144 |
2141 /* Get current position in .xdata section */ | 2145 /* Get current position in .xdata section */ |
2142 unwindpos = yasm_symtab_define_curpos(object->symtab, "$", | 2146 unwindpos = yasm_symtab_define_curpos(object->symtab, "$", |
2143 yasm_section_bcs_last(sect), line); | 2147 yasm_section_bcs_last(sect), line); |
2144 /* Get symbol for .xdata as we'll want to reference it with WRT */ | 2148 /* Get symbol for .xdata as we'll want to reference it with WRT */ |
2145 csd = yasm_section_get_data(sect, &coff_section_data_cb); | 2149 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
2146 xdata_sym = csd->sym; | 2150 xdata_sym = csd->sym; |
2147 | 2151 |
2148 /* Add unwind info. Use line number of start of procedure. */ | 2152 /* Add unwind info. Use line number of start of procedure. */ |
2149 yasm_win64__unwind_generate(sect, objfmt_coff->unwind, | 2153 yasm_win64__unwind_generate(sect, objfmt_coff->unwind, |
2150 objfmt_coff->proc_frame); | 2154 objfmt_coff->proc_frame); |
2151 objfmt_coff->unwind = NULL; /* generate keeps the unwind pointer */ | 2155 objfmt_coff->unwind = NULL; /* generate keeps the unwind pointer */ |
2152 | 2156 |
2153 /* | 2157 /* |
2154 * Add function lookup to end of .pdata section. | 2158 * Add function lookup to end of .pdata section. |
2155 */ | 2159 */ |
2156 | 2160 |
2157 sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, &isnew, line); | 2161 sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, &isnew, line); |
2158 | 2162 |
2159 /* Initialize pdata section if needed */ | 2163 /* Initialize pdata section if needed */ |
2160 if (isnew) { | 2164 if (isnew) { |
2161 csd = coff_objfmt_init_new_section(object, sect, ".pdata", line); | 2165 csd = yasm_section_get_data(sect, &coff_section_data_cb); |
2162 csd->flags = COFF_STYP_DATA | COFF_STYP_READ; | 2166 csd->flags = COFF_STYP_DATA | COFF_STYP_READ; |
2163 csd->flags2 = COFF_FLAG_NOBASE; | 2167 csd->flags2 = COFF_FLAG_NOBASE; |
2164 yasm_section_set_align(sect, 4, line); | 2168 yasm_section_set_align(sect, 4, line); |
2165 } | 2169 } |
2166 | 2170 |
2167 /* Add function structure as data bytecode */ | 2171 /* Add function structure as data bytecode */ |
2168 yasm_dvs_initialize(&dvs); | 2172 yasm_dvs_initialize(&dvs); |
2169 yasm_dvs_append(&dvs, yasm_dv_create_expr( | 2173 yasm_dvs_append(&dvs, yasm_dv_create_expr( |
2170 yasm_expr_create_ident(yasm_expr_sym(proc_sym), line))); | 2174 yasm_expr_create_ident(yasm_expr_sym(proc_sym), line))); |
2171 yasm_dvs_append(&dvs, yasm_dv_create_expr( | 2175 yasm_dvs_append(&dvs, yasm_dv_create_expr( |
(...skipping 29 matching lines...) Expand all Loading... |
2201 32, | 2205 32, |
2202 0, | 2206 0, |
2203 coff_objfmt_dbgfmt_keywords, | 2207 coff_objfmt_dbgfmt_keywords, |
2204 "null", | 2208 "null", |
2205 coff_objfmt_directives, | 2209 coff_objfmt_directives, |
2206 NULL, /* no standard macros */ | 2210 NULL, /* no standard macros */ |
2207 coff_objfmt_create, | 2211 coff_objfmt_create, |
2208 coff_objfmt_output, | 2212 coff_objfmt_output, |
2209 coff_objfmt_destroy, | 2213 coff_objfmt_destroy, |
2210 coff_objfmt_add_default_section, | 2214 coff_objfmt_add_default_section, |
| 2215 coff_objfmt_init_new_section, |
2211 coff_objfmt_section_switch, | 2216 coff_objfmt_section_switch, |
2212 coff_objfmt_get_special_sym | 2217 coff_objfmt_get_special_sym |
2213 }; | 2218 }; |
2214 | 2219 |
2215 /* Define valid debug formats to use with this object format */ | 2220 /* Define valid debug formats to use with this object format */ |
2216 static const char *winXX_objfmt_dbgfmt_keywords[] = { | 2221 static const char *winXX_objfmt_dbgfmt_keywords[] = { |
2217 "null", | 2222 "null", |
2218 "dwarf2", | 2223 "dwarf2", |
2219 "cv8", | 2224 "cv8", |
2220 NULL | 2225 NULL |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 32, | 2258 32, |
2254 1, | 2259 1, |
2255 winXX_objfmt_dbgfmt_keywords, | 2260 winXX_objfmt_dbgfmt_keywords, |
2256 "null", | 2261 "null", |
2257 win32_objfmt_directives, | 2262 win32_objfmt_directives, |
2258 win32_objfmt_stdmacs, | 2263 win32_objfmt_stdmacs, |
2259 win32_objfmt_create, | 2264 win32_objfmt_create, |
2260 coff_objfmt_output, | 2265 coff_objfmt_output, |
2261 coff_objfmt_destroy, | 2266 coff_objfmt_destroy, |
2262 coff_objfmt_add_default_section, | 2267 coff_objfmt_add_default_section, |
| 2268 coff_objfmt_init_new_section, |
2263 coff_objfmt_section_switch, | 2269 coff_objfmt_section_switch, |
2264 coff_objfmt_get_special_sym | 2270 coff_objfmt_get_special_sym |
2265 }; | 2271 }; |
2266 | 2272 |
2267 static const yasm_directive win64_objfmt_directives[] = { | 2273 static const yasm_directive win64_objfmt_directives[] = { |
2268 { ".ident", "gas", dir_ident, YASM_DIR_ANY }, | 2274 { ".ident", "gas", dir_ident, YASM_DIR_ANY }, |
2269 { "ident", "nasm", dir_ident, YASM_DIR_ANY }, | 2275 { "ident", "nasm", dir_ident, YASM_DIR_ANY }, |
2270 { ".export", "gas", dir_export, YASM_DIR_ID_REQUIRED }, | 2276 { ".export", "gas", dir_export, YASM_DIR_ID_REQUIRED }, |
2271 { "export", "nasm", dir_export, YASM_DIR_ID_REQUIRED }, | 2277 { "export", "nasm", dir_export, YASM_DIR_ID_REQUIRED }, |
2272 { ".proc_frame", "gas", dir_proc_frame, YASM_DIR_ID_REQUIRED }, | 2278 { ".proc_frame", "gas", dir_proc_frame, YASM_DIR_ID_REQUIRED }, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 64, | 2313 64, |
2308 1, | 2314 1, |
2309 winXX_objfmt_dbgfmt_keywords, | 2315 winXX_objfmt_dbgfmt_keywords, |
2310 "null", | 2316 "null", |
2311 win64_objfmt_directives, | 2317 win64_objfmt_directives, |
2312 win64_objfmt_stdmacs, | 2318 win64_objfmt_stdmacs, |
2313 win64_objfmt_create, | 2319 win64_objfmt_create, |
2314 coff_objfmt_output, | 2320 coff_objfmt_output, |
2315 coff_objfmt_destroy, | 2321 coff_objfmt_destroy, |
2316 coff_objfmt_add_default_section, | 2322 coff_objfmt_add_default_section, |
| 2323 coff_objfmt_init_new_section, |
2317 coff_objfmt_section_switch, | 2324 coff_objfmt_section_switch, |
2318 coff_objfmt_get_special_sym | 2325 coff_objfmt_get_special_sym |
2319 }; | 2326 }; |
2320 yasm_objfmt_module yasm_x64_LTX_objfmt = { | 2327 yasm_objfmt_module yasm_x64_LTX_objfmt = { |
2321 "Win64", | 2328 "Win64", |
2322 "x64", | 2329 "x64", |
2323 "obj", | 2330 "obj", |
2324 64, | 2331 64, |
2325 1, | 2332 1, |
2326 winXX_objfmt_dbgfmt_keywords, | 2333 winXX_objfmt_dbgfmt_keywords, |
2327 "null", | 2334 "null", |
2328 win64_objfmt_directives, | 2335 win64_objfmt_directives, |
2329 win64_objfmt_stdmacs, | 2336 win64_objfmt_stdmacs, |
2330 win64_objfmt_create, | 2337 win64_objfmt_create, |
2331 coff_objfmt_output, | 2338 coff_objfmt_output, |
2332 coff_objfmt_destroy, | 2339 coff_objfmt_destroy, |
2333 coff_objfmt_add_default_section, | 2340 coff_objfmt_add_default_section, |
| 2341 coff_objfmt_init_new_section, |
2334 coff_objfmt_section_switch, | 2342 coff_objfmt_section_switch, |
2335 coff_objfmt_get_special_sym | 2343 coff_objfmt_get_special_sym |
2336 }; | 2344 }; |
OLD | NEW |