OLD | NEW |
1 /* | 1 /* |
2 * Mac OS X ABI Mach-O File Format | 2 * Mac OS X ABI Mach-O File Format |
3 * | 3 * |
4 * Copyright (C) 2007 Henryk Richter, built upon xdf objfmt (C) Peter Johnson | 4 * Copyright (C) 2007 Henryk Richter, built upon xdf objfmt (C) Peter Johnson |
5 * | 5 * |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 intn = yasm_expr_get_intnum(csize, 1); | 915 intn = yasm_expr_get_intnum(csize, 1); |
916 if (!intn) { | 916 if (!intn) { |
917 yasm_error_set(YASM_ERROR_NOT_CONSTANT, | 917 yasm_error_set(YASM_ERROR_NOT_CONSTANT, |
918 N_("COMMON data size not an integer expressio
n")); | 918 N_("COMMON data size not an integer expressio
n")); |
919 yasm_errwarn_propagate(info->errwarns, (*csize)->line); | 919 yasm_errwarn_propagate(info->errwarns, (*csize)->line); |
920 } else | 920 } else |
921 yasm_intnum_set_uint(val, yasm_intnum_get_uint(intn)); | 921 yasm_intnum_set_uint(val, yasm_intnum_get_uint(intn)); |
922 } | 922 } |
923 /*printf("common symbol %s val %lu\n", name, yasm_intnum_get_uint(va
l));*/ | 923 /*printf("common symbol %s val %lu\n", name, yasm_intnum_get_uint(va
l));*/ |
924 } else if (vis & YASM_SYM_GLOBAL) { | 924 } else if (vis & YASM_SYM_GLOBAL) { |
925 n_type |= N_EXT; | 925 yasm_valparamhead *valparams = |
| 926 yasm_symrec_get_objext_valparams(sym); |
| 927 |
| 928 struct macho_global_data { |
| 929 unsigned long flag; /* N_PEXT */ |
| 930 } data; |
| 931 |
| 932 data.flag = 0; |
| 933 |
| 934 if (valparams) { |
| 935 static const yasm_dir_help help[] = { |
| 936 { "private_extern", 0, yasm_dir_helper_flag_set, |
| 937 offsetof(struct macho_global_data, flag), N_PEXT }, |
| 938 }; |
| 939 yasm_dir_helper(sym, yasm_vps_first(valparams), |
| 940 yasm_symrec_get_decl_line(sym), help, NELEMS(hel
p), |
| 941 &data, yasm_dir_helper_valparam_warn); |
| 942 } |
| 943 |
| 944 n_type |= N_EXT | data.flag; |
926 } | 945 } |
927 | 946 |
928 localbuf = info->buf; | 947 localbuf = info->buf; |
929 YASM_WRITE_32_L(localbuf, info->indx); /* offset in string table */ | 948 YASM_WRITE_32_L(localbuf, info->indx); /* offset in string table */ |
930 YASM_WRITE_8(localbuf, n_type); /* type of symbol entry */ | 949 YASM_WRITE_8(localbuf, n_type); /* type of symbol entry */ |
931 n_sect = (scnum >= 0) ? scnum + 1 : NO_SECT; | 950 n_sect = (scnum >= 0) ? scnum + 1 : NO_SECT; |
932 YASM_WRITE_8(localbuf, n_sect); /* referring section where symbol is fou
nd */ | 951 YASM_WRITE_8(localbuf, n_sect); /* referring section where symbol is fou
nd */ |
933 YASM_WRITE_16_L(localbuf, n_desc); /* extra description */ | 952 YASM_WRITE_16_L(localbuf, n_desc); /* extra description */ |
934 yasm_intnum_get_sized(val, localbuf, long_int_bytes, ((long_int_bytes) <
< 3), 0, 0, 0); /* value/argument */ | 953 yasm_intnum_get_sized(val, localbuf, long_int_bytes, ((long_int_bytes) <
< 3), 0, 0, 0); /* value/argument */ |
935 localbuf += long_int_bytes; | 954 localbuf += long_int_bytes; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 NULL, /* no directives */ | 1615 NULL, /* no directives */ |
1597 NULL, /* no standard macros */ | 1616 NULL, /* no standard macros */ |
1598 macho64_objfmt_create, | 1617 macho64_objfmt_create, |
1599 macho_objfmt_output, | 1618 macho_objfmt_output, |
1600 macho_objfmt_destroy, | 1619 macho_objfmt_destroy, |
1601 macho_objfmt_add_default_section, | 1620 macho_objfmt_add_default_section, |
1602 macho_objfmt_init_new_section, | 1621 macho_objfmt_init_new_section, |
1603 macho_objfmt_section_switch, | 1622 macho_objfmt_section_switch, |
1604 macho_objfmt_get_special_sym | 1623 macho_objfmt_get_special_sym |
1605 }; | 1624 }; |
OLD | NEW |