From 52affeb01a43d3a7931a559b154080eafaba8370 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 14 Nov 2007 08:33:32 +0000 Subject: [PATCH] Add NASM-compatible multi-section binary support to bin object format. This allows for arbitrary load (LMA) and execution (VMA) addresses. The following new section attributes are supported: - start (LMA start address) - follows (follow another section's last LMA) - align (LMA alignment) - vstart (VMA start address) - vfollows (follow another section's last VMA) - valign (VMA alignment) In addition, sections can be designed progbits or nobits. The following special symbols are generated for program use: - section..start (LMA start address) - section..vstart (VMA start address) - section..length (section length) The ORG directive adjusts the file offset relative to LMA, so that if ORG=0x100, a section with LMA=0x100 will be at file offset 0. VMA addresses are the same as LMA addresses unless otherwise specified. Full map file support is supported via the [MAP] directive. The map output filename can be set either as a parameter to the [MAP] directive or on the command line with --mapfile=. MAP options are BRIEF, SECTIONS, SEGMENTS, SYMBOLS, and ALL (all of the above). If no filename is specified either on the command line or in the source file, the map is output to standard output. Full documentation will be added to the Yasm manual in the near future. This implementation supports several configurations NASM does not, for instance http://osdir.com/ml/lang.nasm.devel/2004-12/msg00032.html . It is also fully 64-bit aware. Fixes: #71, #99. svn path=/trunk/yasm/; revision=2010 --- frontends/yasm/yasm.c | 49 +- libyasm/intnum.c | 44 + libyasm/intnum.h | 13 + libyasm/section.c | 30 +- libyasm/section.h | 20 +- libyasm/valparam.c | 17 + libyasm/valparam.h | 17 + modules/dbgfmts/codeview/cv-symline.c | 2 +- modules/dbgfmts/codeview/cv-type.c | 2 +- modules/dbgfmts/dwarf2/dwarf2-aranges.c | 2 +- modules/dbgfmts/dwarf2/dwarf2-info.c | 4 +- modules/dbgfmts/dwarf2/dwarf2-line.c | 4 +- modules/dbgfmts/stabs/stabs-dbgfmt.c | 4 +- modules/objfmts/bin/bin-objfmt.c | 1597 ++- modules/objfmts/bin/tests/Makefile.inc | 4 + .../objfmts/bin/tests/multisect/Makefile.inc | 53 + .../objfmts/bin/tests/multisect/bin-align.asm | 12 + .../bin/tests/multisect/bin-align.errwarn | 3 + .../objfmts/bin/tests/multisect/bin-align.hex | 17 + .../objfmts/bin/tests/multisect/bin-align.map | 66 + .../objfmts/bin/tests/multisect/bin-ssym.asm | 5 + .../objfmts/bin/tests/multisect/bin-ssym.hex | 25 + .../objfmts/bin/tests/multisect/bin-ssym.map | 16 + .../bin/tests/multisect/bin_multi_test.sh | 114 + .../bin/tests/multisect/follows-loop1-err.asm | 2 + .../tests/multisect/follows-loop1-err.errwarn | 1 + .../bin/tests/multisect/follows-loop2-err.asm | 1 + .../tests/multisect/follows-loop2-err.errwarn | 1 + .../tests/multisect/follows-notfound-err.asm | 2 + .../multisect/follows-notfound-err.errwarn | 1 + .../objfmts/bin/tests/multisect/initbss.asm | 5 + .../bin/tests/multisect/initbss.errwarn | 2 + .../objfmts/bin/tests/multisect/initbss.hex | 0 .../objfmts/bin/tests/multisect/initbss.map | 17 + .../bin/tests/multisect/ldlinux-sects.asm | 102 + .../bin/tests/multisect/ldlinux-sects.hex | 11363 ++++++++++++++++ .../bin/tests/multisect/ldlinux-sects.map | 148 + .../bin/tests/multisect/multisect1.asm | 31 + .../bin/tests/multisect/multisect1.hex | 20 + .../bin/tests/multisect/multisect1.map | 78 + .../bin/tests/multisect/multisect2.asm | 42 + .../bin/tests/multisect/multisect2.hex | 66 + .../bin/tests/multisect/multisect2.map | 74 + .../bin/tests/multisect/multisect3.asm | 9 + .../bin/tests/multisect/multisect3.hex | 2 + .../bin/tests/multisect/multisect3.map | 54 + .../bin/tests/multisect/multisect4.asm | 31 + .../bin/tests/multisect/multisect4.hex | 768 ++ .../bin/tests/multisect/multisect4.map | 97 + .../bin/tests/multisect/multisect5.asm | 22 + .../bin/tests/multisect/multisect5.hex | 1816 +++ .../bin/tests/multisect/multisect5.map | 138 + .../bin/tests/multisect/nomultisect1.asm | 10 + .../bin/tests/multisect/nomultisect1.hex | 512 + .../bin/tests/multisect/nomultisect1.map | 54 + .../bin/tests/multisect/nomultisect2.asm | 12 + .../bin/tests/multisect/nomultisect2.hex | 512 + .../bin/tests/multisect/nomultisect2.map | 54 + .../tests/multisect/vfollows-loop1-err.asm | 2 + .../multisect/vfollows-loop1-err.errwarn | 1 + .../tests/multisect/vfollows-loop2-err.asm | 1 + .../multisect/vfollows-loop2-err.errwarn | 1 + .../tests/multisect/vfollows-notfound-err.asm | 2 + .../multisect/vfollows-notfound-err.errwarn | 1 + modules/objfmts/coff/coff-objfmt.c | 11 +- modules/objfmts/dbg/dbg-objfmt.c | 9 +- modules/objfmts/elf/elf-objfmt.c | 4 +- modules/objfmts/macho/macho-objfmt.c | 6 +- modules/objfmts/rdf/rdf-objfmt.c | 4 +- modules/objfmts/xdf/xdf-objfmt.c | 4 +- 70 files changed, 17964 insertions(+), 249 deletions(-) create mode 100644 modules/objfmts/bin/tests/multisect/Makefile.inc create mode 100644 modules/objfmts/bin/tests/multisect/bin-align.asm create mode 100644 modules/objfmts/bin/tests/multisect/bin-align.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/bin-align.hex create mode 100644 modules/objfmts/bin/tests/multisect/bin-align.map create mode 100644 modules/objfmts/bin/tests/multisect/bin-ssym.asm create mode 100644 modules/objfmts/bin/tests/multisect/bin-ssym.hex create mode 100644 modules/objfmts/bin/tests/multisect/bin-ssym.map create mode 100755 modules/objfmts/bin/tests/multisect/bin_multi_test.sh create mode 100644 modules/objfmts/bin/tests/multisect/follows-loop1-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/follows-loop2-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/follows-notfound-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/initbss.asm create mode 100644 modules/objfmts/bin/tests/multisect/initbss.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/initbss.hex create mode 100644 modules/objfmts/bin/tests/multisect/initbss.map create mode 100644 modules/objfmts/bin/tests/multisect/ldlinux-sects.asm create mode 100644 modules/objfmts/bin/tests/multisect/ldlinux-sects.hex create mode 100644 modules/objfmts/bin/tests/multisect/ldlinux-sects.map create mode 100644 modules/objfmts/bin/tests/multisect/multisect1.asm create mode 100644 modules/objfmts/bin/tests/multisect/multisect1.hex create mode 100644 modules/objfmts/bin/tests/multisect/multisect1.map create mode 100644 modules/objfmts/bin/tests/multisect/multisect2.asm create mode 100644 modules/objfmts/bin/tests/multisect/multisect2.hex create mode 100644 modules/objfmts/bin/tests/multisect/multisect2.map create mode 100644 modules/objfmts/bin/tests/multisect/multisect3.asm create mode 100644 modules/objfmts/bin/tests/multisect/multisect3.hex create mode 100644 modules/objfmts/bin/tests/multisect/multisect3.map create mode 100644 modules/objfmts/bin/tests/multisect/multisect4.asm create mode 100644 modules/objfmts/bin/tests/multisect/multisect4.hex create mode 100644 modules/objfmts/bin/tests/multisect/multisect4.map create mode 100644 modules/objfmts/bin/tests/multisect/multisect5.asm create mode 100644 modules/objfmts/bin/tests/multisect/multisect5.hex create mode 100644 modules/objfmts/bin/tests/multisect/multisect5.map create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect1.asm create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect1.hex create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect1.map create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect2.asm create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect2.hex create mode 100644 modules/objfmts/bin/tests/multisect/nomultisect2.map create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm create mode 100644 modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index cde5fef8..117be48c 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -44,7 +44,7 @@ #define PREPROC_BUF_SIZE 16384 /*@null@*/ /*@only@*/ static char *obj_filename = NULL, *in_filename = NULL; -/*@null@*/ /*@only@*/ static char *list_filename = NULL; +/*@null@*/ /*@only@*/ static char *list_filename = NULL, *map_filename = NULL; /*@null@*/ /*@only@*/ static char *machine_name = NULL; static int special_options = 0; /*@null@*/ /*@dependent@*/ static yasm_arch *cur_arch = NULL; @@ -91,6 +91,7 @@ static int opt_dbgfmt_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_listfmt_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_listfile_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_objfile_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_mapfile_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_machine_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_strict_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_warning_handler(char *cmd, /*@null@*/ char *param, int extra); @@ -153,6 +154,8 @@ static opt_option options[] = N_("name of list-file output"), N_("listfile") }, { 'o', "objfile", 1, opt_objfile_handler, 0, N_("name of object-file output"), N_("filename") }, + { 0, "mapfile", 1, opt_mapfile_handler, 0, + N_("name of map-file output"), N_("filename") }, { 'm', "machine", 1, opt_machine_handler, 0, N_("select machine (list with -m help)"), N_("machine") }, { 0, "force-strict", 0, opt_strict_handler, 0, @@ -436,6 +439,32 @@ do_assemble(void) yasm_arch_set_var(cur_arch, "force_strict", force_strict); + /* Try to enable the map file via a map NASM directive. This is + * somewhat of a hack. + */ + if (map_filename && cur_objfmt_module->directives) { + const yasm_directive *dir = &cur_objfmt_module->directives[0]; + matched = 0; + for (; dir->name; dir++) { + if (yasm__strcasecmp(dir->name, "map") == 0 && + yasm__strcasecmp(dir->parser, "nasm") == 0) { + yasm_valparamhead vps; + yasm_valparam *vp; + matched = 1; + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, yasm__xstrdup(map_filename)); + yasm_vps_append(&vps, vp); + dir->handler(object, &vps, NULL, 0); + yasm_vps_delete(&vps); + } + } + if (!matched) { + print_error( + _("warning: object format `%s' does not support map files"), + cur_objfmt_module->keyword); + } + } + /* Parse! */ cur_parser_module->do_parse(object, cur_preproc, list_filename != NULL, linemap, errwarns); @@ -718,6 +747,8 @@ cleanup(yasm_object *object) yasm_xfree(obj_filename); if (list_filename) yasm_xfree(list_filename); + if (map_filename) + yasm_xfree(map_filename); if (machine_name) yasm_xfree(machine_name); if (objfmt_keyword) @@ -923,6 +954,22 @@ opt_objfile_handler(/*@unused@*/ char *cmd, char *param, return 0; } +static int +opt_mapfile_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + if (map_filename) { + print_error( + _("warning: can output to only one map file, last specified used")); + yasm_xfree(map_filename); + } + + assert(param != NULL); + map_filename = yasm__xstrdup(param); + + return 0; +} + static int opt_machine_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 2820fa2e..df32b8cb 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -562,12 +562,56 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand) } /*@=nullderef =nullpass =branchstate@*/ +int +yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2) +{ + wordptr op1, op2; + + if (intn1->type == INTNUM_L && intn2->type == INTNUM_L) { + if (intn1->val.l < intn2->val.l) + return -1; + if (intn1->val.l > intn2->val.l) + return 1; + return 0; + } + + op1 = intnum_tobv(op1static, intn1); + op2 = intnum_tobv(op2static, intn2); + return BitVector_Compare(op1, op2); +} + void yasm_intnum_zero(yasm_intnum *intn) { yasm_intnum_set_int(intn, 0); } +void +yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val) +{ + if (intn->type == val->type) { + switch (val->type) { + case INTNUM_L: + intn->val.l = val->val.l; + break; + case INTNUM_BV: + BitVector_Copy(intn->val.bv, val->val.bv); + break; + } + } else { + switch (val->type) { + case INTNUM_L: + BitVector_Destroy(intn->val.bv); + intn->val.l = val->val.l; + break; + case INTNUM_BV: + intn->val.bv = BitVector_Clone(val->val.bv); + break; + } + intn->type = val->type; + } +} + void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val) { diff --git a/libyasm/intnum.h b/libyasm/intnum.h index 36cb6fea..382f5fb1 100644 --- a/libyasm/intnum.h +++ b/libyasm/intnum.h @@ -125,11 +125,24 @@ void yasm_intnum_destroy(/*@only@*/ yasm_intnum *intn); */ int yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand); +/** Compare two intnums. + * \param intn1 first intnum + * \param intn2 second intnum + * \return -1 if intn1 < intn2, 0 if intn1 == intn2, 1 if intn1 > intn2. + */ +int yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2); + /** Zero an intnum. * \param intn intnum */ void yasm_intnum_zero(yasm_intnum *intn); +/** Set an intnum to the value of another intnum. + * \param intn intnum + * \param val intnum to get value from + */ +void yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val); + /** Set an intnum to an unsigned integer. * \param intn intnum * \param val integer value diff --git a/libyasm/section.c b/libyasm/section.c index c5b83cb8..a767e309 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -62,8 +62,6 @@ struct yasm_section { /* associated data; NULL if none */ /*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data; - /*@owned@*/ yasm_expr *start; /* Starting address of section contents */ - unsigned long align; /* Section alignment */ unsigned long opt_flags; /* storage for optimizer flags */ @@ -300,8 +298,8 @@ error: /*@-onlytrans@*/ yasm_section * yasm_object_get_general(yasm_object *object, const char *name, - yasm_expr *start, unsigned long align, int code, - int res_only, int *isnew, unsigned long line) + unsigned long align, int code, int res_only, + int *isnew, unsigned long line) { yasm_section *s; yasm_bytecode *bc; @@ -325,12 +323,6 @@ yasm_object_get_general(yasm_object *object, const char *name, s->object = object; s->name = yasm__xstrdup(name); s->assoc_data = NULL; - if (start) - s->start = start; - else - s->start = - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(0)), - line); s->align = align; /* Initialize bytecodes with one empty bytecode (acts as "prior" for first @@ -630,20 +622,6 @@ yasm_section_get_name(const yasm_section *sect) return sect->name; } -void -yasm_section_set_start(yasm_section *sect, yasm_expr *start, - unsigned long line) -{ - yasm_expr_destroy(sect->start); - sect->start = start; -} - -const yasm_expr * -yasm_section_get_start(const yasm_section *sect) -{ - return sect->start; -} - void yasm_section_set_align(yasm_section *sect, unsigned long align, unsigned long line) @@ -668,7 +646,6 @@ yasm_section_destroy(yasm_section *sect) yasm_xfree(sect->name); yasm__assoc_data_destroy(sect->assoc_data); - yasm_expr_destroy(sect->start); /* Delete bytecodes */ cur = STAILQ_FIRST(§->bcs); @@ -700,9 +677,6 @@ yasm_section_print(const yasm_section *sect, FILE *f, int indent_level, } fprintf(f, "%*sname=%s\n", indent_level, "", sect->name); - fprintf(f, "%*sstart=", indent_level, ""); - yasm_expr_print(sect->start, f); - fprintf(f, "\n"); if (sect->assoc_data) { fprintf(f, "%*sAssociated data:\n", indent_level, ""); diff --git a/libyasm/section.h b/libyasm/section.h index bb7d3c13..d42040a6 100644 --- a/libyasm/section.h +++ b/libyasm/section.h @@ -89,8 +89,6 @@ struct yasm_object { * added to the object if there's not already a section by that name. * \param object object * \param name section name - * \param start starting address (ignored if section already exists), - * NULL if 0 or don't care. * \param align alignment in bytes (0 if none) * \param code if nonzero, section is intended to contain code * (e.g. alignment should be made with NOP instructions, not 0) @@ -102,8 +100,7 @@ struct yasm_object { * \return New section. */ /*@dependent@*/ yasm_section *yasm_object_get_general - (yasm_object *object, const char *name, - /*@null@*/ /*@only@*/ yasm_expr *start, unsigned long align, int code, + (yasm_object *object, const char *name, unsigned long align, int code, int res_only, /*@out@*/ int *isnew, unsigned long line); /** Handle a directive. Passed down to object format, debug format, or @@ -311,21 +308,6 @@ int yasm_section_bcs_traverse */ /*@observer@*/ const char *yasm_section_get_name(const yasm_section *sect); -/** Change starting address of a section. - * \param sect section - * \param start starting address - * \param line virtual line - */ -void yasm_section_set_start(yasm_section *sect, /*@only@*/ yasm_expr *start, - unsigned long line); - -/** Get starting address of a section. - * \param sect section - * \return Starting address. - */ -/*@observer@*/ const yasm_expr *yasm_section_get_start - (const yasm_section *sect); - /** Change alignment of a section. * \param sect section * \param align alignment in bytes diff --git a/libyasm/valparam.c b/libyasm/valparam.c index 4a8a8183..648dfaea 100644 --- a/libyasm/valparam.c +++ b/libyasm/valparam.c @@ -302,6 +302,23 @@ yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line, return 0; } +int +yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line, + void *data, uintptr_t arg) +{ + yasm_object *object = (yasm_object *)obj; + yasm_expr **expr = (yasm_expr **)data; + + if (*expr) + yasm_expr_destroy(*expr); + if (!(*expr = yasm_vp_expr(vp, object->symtab, line))) { + yasm_error_set(YASM_ERROR_VALUE, N_("argument to `%s' is not an expression"), + vp->val); + return -1; + } + return 0; +} + int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg) diff --git a/libyasm/valparam.h b/libyasm/valparam.h index 9646718a..6914435b 100644 --- a/libyasm/valparam.h +++ b/libyasm/valparam.h @@ -326,6 +326,23 @@ int yasm_dir_helper_flag_or(void *obj, yasm_valparam *vp, unsigned long line, int yasm_dir_helper_flag_and(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); +/** Standard helper for yasm_dir_helper() that parses an expr parameter. + * The #yasm_dir_help structure that uses this function should have + * needsparam=1. The obj parameter to yasm_dir_helper() when this helper + * is used MUST point to a #yasm_object. In addition, the data parameter + * that is ultimately passed to this function (e.g. yasm_dir_helper() data + * parameter plus #yasm_dir_help.off) must point to a #yasm_expr * + * initialized to NULL. + * \param obj object; must be #yasm_object + * \param vp valparam + * \param line virtual line number + * \param data pointer to #yasm_expr * + * \param arg unused argument + * \return -1 on error, 0 otherwise. + */ +int yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line, + void *data, uintptr_t arg); + /** Standard helper for yasm_dir_helper() that parses an intnum parameter. * The #yasm_dir_help structure that uses this function should have * needsparam=1. The obj parameter to yasm_dir_helper() when this helper diff --git a/modules/dbgfmts/codeview/cv-symline.c b/modules/dbgfmts/codeview/cv-symline.c index 6d0874f8..ab14b143 100644 --- a/modules/dbgfmts/codeview/cv-symline.c +++ b/modules/dbgfmts/codeview/cv-symline.c @@ -569,7 +569,7 @@ yasm_cv__generate_symline(yasm_object *object, yasm_linemap *linemap, info.linemap = linemap; info.errwarns = errwarns; info.debug_symline = - yasm_object_get_general(object, ".debug$S", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug$S", 1, 0, 0, &new, 0); info.num_lineinfos = 0; STAILQ_INIT(&info.cv8_lineinfos); info.cv8_cur_li = NULL; diff --git a/modules/dbgfmts/codeview/cv-type.c b/modules/dbgfmts/codeview/cv-type.c index 47adc234..0f2fd5d4 100644 --- a/modules/dbgfmts/codeview/cv-type.c +++ b/modules/dbgfmts/codeview/cv-type.c @@ -522,7 +522,7 @@ yasm_cv__generate_type(yasm_object *object) cv_type *type; debug_type = - yasm_object_get_general(object, ".debug$T", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug$T", 1, 0, 0, &new, 0); /* Add label type */ type = cv_type_create(indx++); diff --git a/modules/dbgfmts/dwarf2/dwarf2-aranges.c b/modules/dbgfmts/dwarf2/dwarf2-aranges.c index 0df37b56..0ab0dc58 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-aranges.c +++ b/modules/dbgfmts/dwarf2/dwarf2-aranges.c @@ -89,7 +89,7 @@ yasm_dwarf2__generate_aranges(yasm_object *object, yasm_section *debug_info) dwarf2_aranges_info info; debug_aranges = - yasm_object_get_general(object, ".debug_aranges", 0, + yasm_object_get_general(object, ".debug_aranges", 2*dbgfmt_dwarf2->sizeof_address, 0, 0, &new, 0); diff --git a/modules/dbgfmts/dwarf2/dwarf2-info.c b/modules/dbgfmts/dwarf2/dwarf2-info.c index b6b45eaa..556ca926 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-info.c +++ b/modules/dbgfmts/dwarf2/dwarf2-info.c @@ -267,9 +267,9 @@ yasm_dwarf2__generate_info(yasm_object *object, yasm_section *debug_line, dwarf2_head *head; char *buf; yasm_section *debug_abbrev = - yasm_object_get_general(object, ".debug_abbrev", 0, 4, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug_abbrev", 4, 0, 0, &new, 0); yasm_section *debug_info = - yasm_object_get_general(object, ".debug_info", 0, 4, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug_info", 4, 0, 0, &new, 0); yasm_section_set_align(debug_abbrev, 0, 0); yasm_section_set_align(debug_info, 0, 0); diff --git a/modules/dbgfmts/dwarf2/dwarf2-line.c b/modules/dbgfmts/dwarf2/dwarf2-line.c index e8d84d8c..d3fa76f2 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-line.c +++ b/modules/dbgfmts/dwarf2/dwarf2-line.c @@ -645,8 +645,8 @@ yasm_dwarf2__generate_line(yasm_object *object, yasm_linemap *linemap, info.object = object; info.linemap = linemap; info.dbgfmt_dwarf2 = dbgfmt_dwarf2; - info.debug_line = yasm_object_get_general(object, ".debug_line", 0, 1, 0, - 0, &new, 0); + info.debug_line = yasm_object_get_general(object, ".debug_line", 1, 0, 0, + &new, 0); last = yasm_section_bcs_last(info.debug_line); /* header */ diff --git a/modules/dbgfmts/stabs/stabs-dbgfmt.c b/modules/dbgfmts/stabs/stabs-dbgfmt.c index 5e908308..88d573ab 100644 --- a/modules/dbgfmts/stabs/stabs-dbgfmt.c +++ b/modules/dbgfmts/stabs/stabs-dbgfmt.c @@ -331,7 +331,7 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, info.errwarns = errwarns; info.lastline = 0; info.stabcount = 0; - info.stab = yasm_object_get_general(object, ".stab", 0, 4, 0, 0, &new, 0); + info.stab = yasm_object_get_general(object, ".stab", 4, 0, 0, &new, 0); if (!new) { yasm_bytecode *last = yasm_section_bcs_last(info.stab); if (last == NULL) { @@ -347,7 +347,7 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, } info.stabstr = - yasm_object_get_general(object, ".stabstr", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".stabstr", 1, 0, 0, &new, 0); if (!new) { yasm_bytecode *last = yasm_section_bcs_last(info.stabstr); if (last == NULL) { diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c index 7056f97a..655fab1e 100644 --- a/modules/objfmts/bin/bin-objfmt.c +++ b/modules/objfmts/bin/bin-objfmt.c @@ -32,10 +32,68 @@ #define REGULAR_OUTBUF_SIZE 1024 +typedef struct bin_section_data { + int bss; /* aka nobits */ + + /* User-provided alignment */ + yasm_intnum *align, *valign; + + /* User-provided starts */ + /*@null@*/ /*@owned@*/ yasm_expr *start, *vstart; + + /* User-provided follows */ + /*@null@*/ /*@owned@*/ char *follows, *vfollows; + + /* Calculated (final) starts, used only during output() */ + /*@null@*/ /*@owned@*/ yasm_intnum *istart, *ivstart; + + /* Calculated (final) length, used only during output() */ + /*@null@*/ /*@owned@*/ yasm_intnum *length; +} bin_section_data; + typedef struct yasm_objfmt_bin { yasm_objfmt_base objfmt; /* base structure */ + + enum { + NO_MAP = 0, + MAP_NONE = 0x01, + MAP_BRIEF = 0x02, + MAP_SECTIONS = 0x04, + MAP_SYMBOLS = 0x08 + } map_flags; + /*@null@*/ /*@only@*/ char *map_filename; + + /*@null@*/ /*@only@*/ yasm_expr *org; } yasm_objfmt_bin; +/* symrec data is used only for the special symbols section.start, + * section.vstart, and section.length + */ +typedef struct bin_symrec_data { + yasm_section *section; /* referenced section */ + enum bin_ssym { + SSYM_START, + SSYM_VSTART, + SSYM_LENGTH + } which; +} bin_symrec_data; + +static void bin_section_data_destroy(/*@only@*/ void *d); +static void bin_section_data_print(void *data, FILE *f, int indent_level); + +static const yasm_assoc_data_callback bin_section_data_cb = { + bin_section_data_destroy, + bin_section_data_print +}; + +static void bin_symrec_data_destroy(/*@only@*/ void *d); +static void bin_symrec_data_print(void *data, FILE *f, int indent_level); + +static const yasm_assoc_data_callback bin_symrec_data_cb = { + bin_symrec_data_destroy, + bin_symrec_data_print +}; + yasm_objfmt_module yasm_bin_LTX_objfmt; @@ -44,40 +102,81 @@ bin_objfmt_create(yasm_object *object) { yasm_objfmt_bin *objfmt_bin = yasm_xmalloc(sizeof(yasm_objfmt_bin)); objfmt_bin->objfmt.module = &yasm_bin_LTX_objfmt; + + objfmt_bin->map_flags = MAP_NONE; + objfmt_bin->map_filename = NULL; + objfmt_bin->org = NULL; + return (yasm_objfmt *)objfmt_bin; } -/* Aligns sect to either its specified alignment. Uses prevsect and base to - * both determine the new starting address (returned) and the total length of - * prevsect after sect has been aligned. - */ -static unsigned long -bin_objfmt_align_section(yasm_section *sect, yasm_section *prevsect, - unsigned long base, - /*@out@*/ unsigned long *prevsectlen, - /*@out@*/ unsigned long *padamt) -{ - unsigned long start; - unsigned long align; +typedef TAILQ_HEAD(, bin_group) bin_groups; - /* Figure out the size of .text by looking at the last bytecode's offset - * plus its length. Add the start and size together to get the new start. - */ - *prevsectlen = yasm_bc_next_offset(yasm_section_bcs_last(prevsect)); - start = base + *prevsectlen; +typedef struct bin_group { + TAILQ_ENTRY(bin_group) link; + yasm_section *section; + bin_section_data *bsd; - /* Round new start up to alignment of .data section, and adjust textlen to - * indicate padded size. Because aignment is always a power of two, we - * can use some bit trickery to do this easily. + /* Groups that (in parallel) logically come immediately after this + * group's section. */ - align = yasm_section_get_align(sect); + bin_groups follow_groups; +} bin_group; - if (start & (align-1)) - start = (start & ~(align-1)) + align; +/* Recursive function to find group containing named section. */ +static bin_group * +find_group_by_name(bin_groups *groups, const char *name) +{ + bin_group *group, *found; + TAILQ_FOREACH(group, groups, link) { + if (strcmp(yasm_section_get_name(group->section), name) == 0) + return group; + /* Recurse to loop through follow groups */ + found = find_group_by_name(&group->follow_groups, name); + if (found) + return found; + } + return NULL; +} - *padamt = start - (base + *prevsectlen); +/* Recursive function to find group. Returns NULL if not found. */ +static bin_group * +find_group_by_section(bin_groups *groups, yasm_section *section) +{ + bin_group *group, *found; + TAILQ_FOREACH(group, groups, link) { + if (group->section == section) + return group; + /* Recurse to loop through follow groups */ + found = find_group_by_section(&group->follow_groups, section); + if (found) + return found; + } + return NULL; +} - return start; +static void +print_groups(const bin_groups *groups, int indent_level) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + printf("%*sSection `%s':\n", indent_level, "", + yasm_section_get_name(group->section)); + bin_section_data_print(group->bsd, stdout, indent_level+1); + if (!TAILQ_EMPTY(&group->follow_groups)) { + printf("%*sFollowing groups:\n", indent_level, ""); + print_groups(&group->follow_groups, indent_level+1); + } + } +} + +static void +bin_group_destroy(/*@only@*/ bin_group *group) +{ + bin_group *follow, *group_temp; + TAILQ_FOREACH_SAFE(follow, &group->follow_groups, link, group_temp) + bin_group_destroy(follow); + yasm_xfree(group); } typedef struct bin_objfmt_output_info { @@ -87,21 +186,315 @@ typedef struct bin_objfmt_output_info { /*@only@*/ unsigned char *buf; /*@observer@*/ const yasm_section *sect; unsigned long start; /* what normal variables go against */ - unsigned long abs_start; /* what absolutes go against */ + + yasm_intnum *origin; + yasm_intnum *tmp_intn; /* temporary working intnum */ + + bin_groups lma_groups, vma_groups; } bin_objfmt_output_info; +static int +bin_objfmt_check_sym(yasm_symrec *sym, /*@null@*/ void *d) +{ + /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + assert(info != NULL); + + /* Don't check internally-generated symbols. Only internally generated + * symbols have symrec data, so simply check for its presence. + */ + if (yasm_symrec_get_data(sym, &bin_symrec_data_cb)) + return 0; + + if (vis & YASM_SYM_EXTERN) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("binary object format does not support extern variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } else if (vis & YASM_SYM_GLOBAL) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("binary object format does not support global variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } else if (vis & YASM_SYM_COMMON) { + yasm_error_set(YASM_ERROR_TYPE, + N_("binary object format does not support common variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } + return 0; +} + +static int +bin_lma_create_group(yasm_section *sect, /*@null@*/ void *d) +{ + bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + unsigned long align = yasm_section_get_align(sect); + bin_group *group; + + assert(info != NULL); + assert(bsd != NULL); + + group = yasm_xmalloc(sizeof(bin_group)); + group->section = sect; + group->bsd = bsd; + TAILQ_INIT(&group->follow_groups); + + /* Determine section alignment as necessary. */ + if (!bsd->align) + bsd->align = yasm_intnum_create_uint(align > 4 ? align : 4); + else { + yasm_intnum *align_intn = yasm_intnum_create_uint(align); + if (yasm_intnum_compare(align_intn, bsd->align) > 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("section `%s' internal align of %lu is greater than `%s' of %lu; using `%s'"), + yasm_section_get_name(sect), + yasm_intnum_get_uint(align_intn), + N_("align"), + yasm_intnum_get_uint(bsd->align), + N_("align")); + yasm_errwarn_propagate(info->errwarns, 0); + } + yasm_intnum_destroy(align_intn); + } + + /* Calculate section integer start. */ + if (bsd->start) { + bsd->istart = yasm_expr_get_intnum(&bsd->start, 0); + if (!bsd->istart) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("start expression is too complex")); + yasm_errwarn_propagate(info->errwarns, bsd->start->line); + return 1; + } else + bsd->istart = yasm_intnum_copy(bsd->istart); + } else + bsd->istart = NULL; + + /* Calculate section integer vstart. */ + if (bsd->vstart) { + bsd->ivstart = yasm_expr_get_intnum(&bsd->vstart, 0); + if (!bsd->ivstart) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("vstart expression is too complex")); + yasm_errwarn_propagate(info->errwarns, bsd->vstart->line); + return 1; + } else + bsd->ivstart = yasm_intnum_copy(bsd->ivstart); + } else + bsd->ivstart = NULL; + + /* Calculate section integer length. */ + bsd->length = yasm_calc_bc_dist(yasm_section_bcs_first(sect), + yasm_section_bcs_last(sect)); + + TAILQ_INSERT_TAIL(&info->lma_groups, group, link); + return 0; +} + +static int +bin_vma_create_group(yasm_section *sect, /*@null@*/ void *d) +{ + bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + bin_group *group; + + assert(info != NULL); + assert(bsd != NULL); + + group = yasm_xmalloc(sizeof(bin_group)); + group->section = sect; + group->bsd = bsd; + TAILQ_INIT(&group->follow_groups); + + TAILQ_INSERT_TAIL(&info->vma_groups, group, link); + return 0; +} + +/* Calculates new start address based on alignment constraint. + * Start is modified (rounded up) to the closest aligned value greater than + * what was passed in. + * Align must be a power of 2. + */ +static void +bin_objfmt_align(yasm_intnum *start, const yasm_intnum *align) +{ + /* Because alignment is always a power of two, we can use some bit + * trickery to do this easily. + */ + yasm_intnum *align_intn = + yasm_intnum_create_uint(yasm_intnum_get_uint(align)-1); + yasm_intnum_calc(align_intn, YASM_EXPR_AND, start); + if (!yasm_intnum_is_zero(align_intn)) { + /* start = (start & ~(align-1)) + align; */ + yasm_intnum_set_uint(align_intn, yasm_intnum_get_uint(align)-1); + yasm_intnum_calc(align_intn, YASM_EXPR_NOT, NULL); + yasm_intnum_calc(align_intn, YASM_EXPR_AND, start); + yasm_intnum_set(start, align); + yasm_intnum_calc(start, YASM_EXPR_ADD, align_intn); + } + yasm_intnum_destroy(align_intn); +} + +/* Recursive function to assign start addresses. + * Updates start, last, and vdelta parameters as it goes along. + * The tmp parameter is just a working intnum so one doesn't have to be + * locally allocated for this purpose. + */ +static void +group_assign_start_recurse(bin_group *group, yasm_intnum *start, + yasm_intnum *last, yasm_intnum *vdelta, + yasm_intnum *tmp, yasm_errwarns *errwarns) +{ + bin_group *follow_group; + + /* Determine LMA */ + if (group->bsd->istart) { + yasm_intnum_set(group->bsd->istart, start); + if (group->bsd->align) { + bin_objfmt_align(group->bsd->istart, group->bsd->align); + if (yasm_intnum_compare(start, group->bsd->istart) != 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("start inconsistent with align; using aligned value")); + yasm_errwarn_propagate(errwarns, group->bsd->start->line); + } + } + } else { + group->bsd->istart = yasm_intnum_copy(start); + if (group->bsd->align != 0) + bin_objfmt_align(group->bsd->istart, group->bsd->align); + } + + /* Determine VMA if either just valign specified or if no v* specified */ + if (!group->bsd->vstart) { + if (!group->bsd->vfollows && !group->bsd->valign) { + /* No v* specified, set VMA=LMA+vdelta. */ + group->bsd->ivstart = yasm_intnum_copy(group->bsd->istart); + yasm_intnum_calc(group->bsd->ivstart, YASM_EXPR_ADD, vdelta); + } else if (!group->bsd->vfollows) { + /* Just valign specified: set VMA=LMA+vdelta, align VMA, then add + * delta between unaligned and aligned to vdelta parameter. + */ + group->bsd->ivstart = yasm_intnum_copy(group->bsd->istart); + yasm_intnum_calc(group->bsd->ivstart, YASM_EXPR_ADD, vdelta); + yasm_intnum_set(tmp, group->bsd->ivstart); + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + yasm_intnum_calc(vdelta, YASM_EXPR_ADD, group->bsd->ivstart); + yasm_intnum_calc(vdelta, YASM_EXPR_SUB, tmp); + } + } + + /* Find the maximum end value */ + yasm_intnum_set(tmp, group->bsd->istart); + yasm_intnum_calc(tmp, YASM_EXPR_ADD, group->bsd->length); + if (yasm_intnum_compare(tmp, last) > 0) /* tmp > last */ + yasm_intnum_set(last, tmp); + + /* Recurse for each following group. */ + TAILQ_FOREACH(follow_group, &group->follow_groups, link) { + /* Following sections have to follow this one, + * so add length to start. + */ + yasm_intnum_set(start, group->bsd->istart); + yasm_intnum_calc(start, YASM_EXPR_ADD, group->bsd->length); + + group_assign_start_recurse(follow_group, start, last, vdelta, tmp, + errwarns); + } +} + +/* Recursive function to assign start addresses. + * Updates start parameter as it goes along. + * The tmp parameter is just a working intnum so one doesn't have to be + * locally allocated for this purpose. + */ +static void +group_assign_vstart_recurse(bin_group *group, yasm_intnum *start, + yasm_errwarns *errwarns) +{ + bin_group *follow_group; + + /* Determine VMA section alignment as necessary. + * Default to LMA alignment if not specified. + */ + if (!group->bsd->valign) + group->bsd->valign = yasm_intnum_copy(group->bsd->align); + else { + unsigned long align = yasm_section_get_align(group->section); + yasm_intnum *align_intn = yasm_intnum_create_uint(align); + if (yasm_intnum_compare(align_intn, group->bsd->valign) > 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("section `%s' internal align of %lu is greater than `%s' of %lu; using `%s'"), + yasm_section_get_name(group->section), + yasm_intnum_get_uint(align_intn), + N_("valign"), + yasm_intnum_get_uint(group->bsd->valign), + N_("valign")); + yasm_errwarn_propagate(errwarns, 0); + } + yasm_intnum_destroy(align_intn); + } + + /* Determine VMA */ + if (group->bsd->ivstart) { + yasm_intnum_set(group->bsd->ivstart, start); + if (group->bsd->valign) { + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + if (yasm_intnum_compare(start, group->bsd->ivstart) != 0) { + yasm_error_set(YASM_ERROR_VALUE, + N_("vstart inconsistent with valign")); + yasm_errwarn_propagate(errwarns, group->bsd->vstart->line); + } + } + } else { + group->bsd->ivstart = yasm_intnum_copy(start); + if (group->bsd->valign) + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + } + + /* Recurse for each following group. */ + TAILQ_FOREACH(follow_group, &group->follow_groups, link) { + /* Following sections have to follow this one, + * so add length to start. + */ + yasm_intnum_set(start, group->bsd->ivstart); + yasm_intnum_calc(start, YASM_EXPR_ADD, group->bsd->length); + + group_assign_vstart_recurse(follow_group, start, errwarns); + } +} + +static /*@null@*/ const yasm_intnum * +get_ssym_value(yasm_symrec *sym) +{ + bin_symrec_data *bsymd = yasm_symrec_get_data(sym, &bin_symrec_data_cb); + bin_section_data *bsd; + + if (!bsymd) + return NULL; + + bsd = yasm_section_get_data(bsymd->section, &bin_section_data_cb); + assert(bsd != NULL); + + switch (bsymd->which) { + case SSYM_START: return bsd->istart; + case SSYM_VSTART: return bsd->ivstart; + case SSYM_LENGTH: return bsd->length; + } + return NULL; +} + static /*@only@*/ yasm_expr * bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e, /*@unused@*/ /*@null@*/ void *d) { int i; - /*@dependent@*/ yasm_section *sect; - /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; - /*@null@*/ yasm_intnum *dist; - for (i=0; inumterms; i++) { + /*@dependent@*/ yasm_section *sect; + /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; + /*@null@*/ yasm_intnum *dist; + /*@null@*/ const yasm_intnum *ssymval; + /* Transform symrecs or precbcs that reference sections into - * start expr + intnum(dist). + * vstart + intnum(dist). */ if (((e->terms[i].type == YASM_EXPR_SYM && yasm_symrec_get_label(e->terms[i].data.sym, &precbc)) || @@ -109,18 +502,389 @@ bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e, (precbc = e->terms[i].data.precbc))) && (sect = yasm_bc_get_section(precbc)) && (dist = yasm_calc_bc_dist(yasm_section_bcs_first(sect), precbc))) { - const yasm_expr *start = yasm_section_get_start(sect); - e->terms[i].type = YASM_EXPR_EXPR; - e->terms[i].data.expn = - yasm_expr_create(YASM_EXPR_ADD, - yasm_expr_expr(yasm_expr_copy(start)), - yasm_expr_int(dist), e->line); + bin_section_data *bsd; + bsd = yasm_section_get_data(sect, &bin_section_data_cb); + assert(bsd != NULL); + yasm_intnum_calc(dist, YASM_EXPR_ADD, bsd->ivstart); + e->terms[i].type = YASM_EXPR_INT; + e->terms[i].data.intn = dist; + } + + /* Transform our special symrecs into the appropriate value */ + if (e->terms[i].type == YASM_EXPR_SYM && + (ssymval = get_ssym_value(e->terms[i].data.sym))) { + e->terms[i].type = YASM_EXPR_INT; + e->terms[i].data.intn = yasm_intnum_copy(ssymval); } } return e; } +typedef struct map_output_info { + /* address width */ + size_t bytes; + + /* intnum output static data areas */ + unsigned char *buf; + yasm_intnum *intn; + + /* symrec output information */ + unsigned long count; + yasm_section *section; /* NULL for EQUs */ + + yasm_object *object; /* object */ + FILE *f; /* map output file */ +} map_output_info; + +static int +map_prescan_bytes(yasm_section *sect, void *d) +{ + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + map_output_info *info = (map_output_info *)d; + + assert(bsd != NULL); + assert(info != NULL); + + while (!yasm_intnum_check_size(bsd->length, info->bytes * 8, 0, 0)) + info->bytes *= 2; + while (!yasm_intnum_check_size(bsd->istart, info->bytes * 8, 0, 0)) + info->bytes *= 2; + while (!yasm_intnum_check_size(bsd->ivstart, info->bytes * 8, 0, 0)) + info->bytes *= 2; + + return 0; +} + +static void +map_print_intnum(const yasm_intnum *intn, map_output_info *info) +{ + size_t i; + yasm_intnum_get_sized(intn, info->buf, info->bytes, info->bytes*8, 0, 0, + 0); + for (i=info->bytes; i != 0; i--) + fprintf(info->f, "%02X", info->buf[i-1]); +} + +static void +map_sections_summary(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + bin_section_data *bsd = group->bsd; + + assert(bsd != NULL); + assert(info != NULL); + + map_print_intnum(bsd->ivstart, info); + fprintf(info->f, " "); + + yasm_intnum_set(info->intn, bsd->ivstart); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->length); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + map_print_intnum(bsd->istart, info); + fprintf(info->f, " "); + + yasm_intnum_set(info->intn, bsd->istart); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->length); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + map_print_intnum(bsd->length, info); + fprintf(info->f, " "); + + fprintf(info->f, "%-*s", 10, bsd->bss ? "nobits" : "progbits"); + fprintf(info->f, "%s\n", yasm_section_get_name(group->section)); + + /* Recurse to loop through follow groups */ + map_sections_summary(&group->follow_groups, info); + } +} + +static void +map_sections_detail(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + bin_section_data *bsd = group->bsd; + size_t i; + const char *s; + + s = yasm_section_get_name(group->section); + fprintf(info->f, "---- Section %s ", s); + for (i=0; i<(65-strlen(s)); i++) + fputc('-', info->f); + + fprintf(info->f, "\n\nclass: %s", + bsd->bss ? "nobits" : "progbits"); + fprintf(info->f, "\nlength: "); + map_print_intnum(bsd->length, info); + fprintf(info->f, "\nstart: "); + map_print_intnum(bsd->istart, info); + fprintf(info->f, "\nalign: "); + map_print_intnum(bsd->align, info); + fprintf(info->f, "\nfollows: %s", + bsd->follows ? bsd->follows : "not defined"); + fprintf(info->f, "\nvstart: "); + map_print_intnum(bsd->ivstart, info); + fprintf(info->f, "\nvalign: "); + map_print_intnum(bsd->valign, info); + fprintf(info->f, "\nvfollows: %s\n\n", + bsd->vfollows ? bsd->vfollows : "not defined"); + + /* Recurse to loop through follow groups */ + map_sections_detail(&group->follow_groups, info); + } +} + +static int +map_symrec_count(yasm_symrec *sym, void *d) +{ + map_output_info *info = (map_output_info *)d; + /*@dependent@*/ yasm_bytecode *precbc; + + assert(info != NULL); + + /* TODO: autodetect wider size */ + if (!info->section && yasm_symrec_get_equ(sym)) { + info->count++; + } else if (yasm_symrec_get_label(sym, &precbc) && + yasm_bc_get_section(precbc) == info->section) { + info->count++; + } + return 0; +} + +static int +map_symrec_output(yasm_symrec *sym, void *d) +{ + map_output_info *info = (map_output_info *)d; + const yasm_expr *equ; + /*@dependent@*/ yasm_bytecode *precbc; + + assert(info != NULL); + + if (!info->section && (equ = yasm_symrec_get_equ(sym))) { + yasm_expr *realequ = yasm_expr_copy(equ); + realequ = yasm_expr__level_tree + (realequ, 1, 1, 1, 0, bin_objfmt_expr_xform, NULL); + yasm_intnum_set(info->intn, yasm_expr_get_intnum(&realequ, 0)); + yasm_expr_destroy(realequ); + map_print_intnum(info->intn, info); + fprintf(info->f, " %s\n", yasm_symrec_get_name(sym)); + } else if (yasm_symrec_get_label(sym, &precbc) && + yasm_bc_get_section(precbc) == info->section) { + bin_section_data *bsd = + yasm_section_get_data(info->section, &bin_section_data_cb); + + /* Real address */ + yasm_intnum_set_uint(info->intn, precbc->offset); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->istart); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + /* Virtual address */ + yasm_intnum_set_uint(info->intn, precbc->offset); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->ivstart); + map_print_intnum(info->intn, info); + + /* Name */ + fprintf(info->f, " %s\n", yasm_symrec_get_name(sym)); + } + return 0; +} + +static void +map_sections_symbols(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + info->count = 0; + info->section = group->section; + yasm_symtab_traverse(info->object->symtab, info, map_symrec_count); + + if (info->count > 0) { + const char *s = yasm_section_get_name(group->section); + size_t i; + fprintf(info->f, "---- Section %s ", s); + for (i=0; i<(65-strlen(s)); i++) + fputc('-', info->f); + fprintf(info->f, "\n\n%-*s%-*s%s\n", + info->bytes*2+2, "Real", + info->bytes*2+2, "Virtual", + "Name"); + yasm_symtab_traverse(info->object->symtab, info, + map_symrec_output); + fprintf(info->f, "\n\n"); + } + + /* Recurse to loop through follow groups */ + map_sections_symbols(&group->follow_groups, info); + } +} + +static void +output_map(bin_objfmt_output_info *info) +{ + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)info->object->objfmt; + FILE *f; + int i; + map_output_info mapinfo; + + if (objfmt_bin->map_flags == NO_MAP) + return; + + if (objfmt_bin->map_flags == MAP_NONE) + objfmt_bin->map_flags = MAP_BRIEF; /* default to brief */ + + if (!objfmt_bin->map_filename) + f = stdout; /* default to stdout */ + else { + f = fopen(objfmt_bin->map_filename, "wt"); + if (!f) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("unable to open map file `%s'"), + objfmt_bin->map_filename); + yasm_errwarn_propagate(info->errwarns, 0); + return; + } + } + + mapinfo.object = info->object; + mapinfo.f = f; + + /* Temporary intnum */ + mapinfo.intn = info->tmp_intn; + + /* Prescan all values to figure out what width we should make the output + * fields. Start with a minimum of 4. + */ + mapinfo.bytes = 4; + while (!yasm_intnum_check_size(info->origin, mapinfo.bytes * 8, 0, 0)) + mapinfo.bytes *= 2; + yasm_object_sections_traverse(info->object, &mapinfo, map_prescan_bytes); + mapinfo.buf = yasm_xmalloc(mapinfo.bytes); + + fprintf(f, "\n- YASM Map file "); + for (i=0; i<63; i++) + fputc('-', f); + fprintf(f, "\n\nSource file: %s\n", info->object->src_filename); + fprintf(f, "Output file: %s\n\n", info->object->obj_filename); + + fprintf(f, "-- Program origin "); + for (i=0; i<61; i++) + fputc('-', f); + fprintf(f, "\n\n"); + map_print_intnum(info->origin, &mapinfo); + fprintf(f, "\n\n"); + + if (objfmt_bin->map_flags & MAP_BRIEF) { + fprintf(f, "-- Sections (summary) "); + for (i=0; i<57; i++) + fputc('-', f); + fprintf(f, "\n\n%-*s%-*s%-*s%-*s%-*s%-*s%s\n", + mapinfo.bytes*2+2, "Vstart", + mapinfo.bytes*2+2, "Vstop", + mapinfo.bytes*2+2, "Start", + mapinfo.bytes*2+2, "Stop", + mapinfo.bytes*2+2, "Length", + 10, "Class", "Name"); + + map_sections_summary(&info->lma_groups, &mapinfo); + fprintf(f, "\n"); + } + + if (objfmt_bin->map_flags & MAP_SECTIONS) { + fprintf(f, "-- Sections (detailed) "); + for (i=0; i<56; i++) + fputc('-', f); + fprintf(f, "\n\n"); + map_sections_detail(&info->lma_groups, &mapinfo); + } + + if (objfmt_bin->map_flags & MAP_SYMBOLS) { + fprintf(f, "-- Symbols "); + for (i=0; i<68; i++) + fputc('-', f); + fprintf(f, "\n\n"); + + /* We do two passes for EQU and each section; the first pass + * determines the byte width to use for the value and whether any + * symbols are present, the second pass actually outputs the text. + */ + + /* EQUs */ + mapinfo.count = 0; + mapinfo.section = NULL; + yasm_symtab_traverse(info->object->symtab, &mapinfo, map_symrec_count); + + if (mapinfo.count > 0) { + fprintf(f, "---- No Section "); + for (i=0; i<63; i++) + fputc('-', f); + fprintf(f, "\n\n%-*s%s\n", mapinfo.bytes*2+2, "Value", "Name"); + yasm_symtab_traverse(info->object->symtab, &mapinfo, + map_symrec_output); + fprintf(f, "\n\n"); + } + + /* Other sections */ + map_sections_symbols(&info->lma_groups, &mapinfo); + } + + if (f != stdout) + fclose(f); + + yasm_xfree(mapinfo.buf); +} + +/* Check for LMA overlap using a simple N^2 algorithm. */ +static int +check_lma_overlap(yasm_section *sect, /*@null@*/ void *d) +{ + bin_section_data *bsd, *bsd2; + yasm_section *other = (yasm_section *)d; + yasm_intnum *overlap; + + if (!d) + return yasm_object_sections_traverse(yasm_section_get_object(sect), + sect, check_lma_overlap); + if (sect == other) + return 0; + + bsd = yasm_section_get_data(sect, &bin_section_data_cb); + bsd2 = yasm_section_get_data(other, &bin_section_data_cb); + + if (yasm_intnum_is_zero(bsd->length) || + yasm_intnum_is_zero(bsd2->length)) + return 0; + + if (yasm_intnum_compare(bsd->istart, bsd2->istart) <= 0) { + overlap = yasm_intnum_copy(bsd->istart); + yasm_intnum_calc(overlap, YASM_EXPR_ADD, bsd->length); + yasm_intnum_calc(overlap, YASM_EXPR_SUB, bsd2->istart); + } else { + overlap = yasm_intnum_copy(bsd2->istart); + yasm_intnum_calc(overlap, YASM_EXPR_ADD, bsd2->length); + yasm_intnum_calc(overlap, YASM_EXPR_SUB, bsd->istart); + } + + if (yasm_intnum_sign(overlap) > 0) { + yasm_error_set(YASM_ERROR_GENERAL, + N_("sections `%s' and `%s' overlap by %lu bytes"), + yasm_section_get_name(sect), + yasm_section_get_name(other), + yasm_intnum_get_uint(overlap)); + yasm_intnum_destroy(overlap); + return -1; + } + + yasm_intnum_destroy(overlap); + return 0; +} + static int bin_objfmt_output_value(yasm_value *value, unsigned char *buf, unsigned int destsize, @@ -137,6 +901,7 @@ bin_objfmt_output_value(yasm_value *value, unsigned char *buf, if (value->rel) { unsigned int rshift = (unsigned int)value->rshift; yasm_expr *syme; + /*@null@*/ const yasm_intnum *ssymval; if (yasm_symrec_is_abs(value->rel)) { syme = yasm_expr_create_ident(yasm_expr_int( @@ -144,6 +909,9 @@ bin_objfmt_output_value(yasm_value *value, unsigned char *buf, } else if (yasm_symrec_get_label(value->rel, &precbc) && (sect = yasm_bc_get_section(precbc))) { syme = yasm_expr_create_ident(yasm_expr_sym(value->rel), bc->line); + } else if ((ssymval = get_ssym_value(value->rel))) { + syme = yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_copy(ssymval)), bc->line); } else goto done; @@ -241,139 +1009,401 @@ bin_objfmt_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d) return 0; } +/* Check to ensure bytecode is res* (for BSS sections) */ static int -bin_objfmt_check_sym(yasm_symrec *sym, /*@null@*/ void *d) +bin_objfmt_no_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d) { /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; - yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + /*@null@*/ /*@only@*/ unsigned char *bigbuf; + unsigned long size = REGULAR_OUTBUF_SIZE; + int gap; + assert(info != NULL); - if (vis & YASM_SYM_EXTERN) { - yasm_warn_set(YASM_WARN_GENERAL, - N_("binary object format does not support extern variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); - } else if (vis & YASM_SYM_GLOBAL) { + bigbuf = yasm_bc_tobytes(bc, info->buf, &size, &gap, info, + bin_objfmt_output_value, NULL); + + /* If bigbuf was allocated, free it */ + if (bigbuf) + yasm_xfree(bigbuf); + + /* Don't bother doing anything else if size ended up being 0. */ + if (size == 0) + return 0; + + /* Warn if not a gap. */ + if (!gap) { yasm_warn_set(YASM_WARN_GENERAL, - N_("binary object format does not support global variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); - } else if (vis & YASM_SYM_COMMON) { - yasm_error_set(YASM_ERROR_TYPE, - N_("binary object format does not support common variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + N_("initialized space declared in nobits section: ignoring")); + } + + return 0; +} + +static int +bin_objfmt_output_section(yasm_section *sect, /*@null@*/ void *d) +{ + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + + assert(bsd != NULL); + assert(info != NULL); + + if (bsd->bss) { + yasm_section_bcs_traverse(sect, info->errwarns, + info, bin_objfmt_no_output_bytecode); + } else { + yasm_intnum_set(info->tmp_intn, bsd->istart); + yasm_intnum_calc(info->tmp_intn, YASM_EXPR_SUB, info->origin); + if (yasm_intnum_sign(info->tmp_intn) < 0) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' starts before origin (ORG)"), + yasm_section_get_name(sect)); + yasm_errwarn_propagate(info->errwarns, 0); + return 0; + } + if (!yasm_intnum_check_size(info->tmp_intn, sizeof(long)*8, 0, 1)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' start value too large"), + yasm_section_get_name(sect)); + yasm_errwarn_propagate(info->errwarns, 0); + return 0; + } + fseek(info->f, yasm_intnum_get_int(info->tmp_intn), SEEK_SET); + yasm_section_bcs_traverse(sect, info->errwarns, + info, bin_objfmt_output_bytecode); } + return 0; } +static void +bin_objfmt_cleanup(bin_objfmt_output_info *info) +{ + bin_group *group, *group_temp; + + yasm_xfree(info->buf); + yasm_intnum_destroy(info->origin); + yasm_intnum_destroy(info->tmp_intn); + + TAILQ_FOREACH_SAFE(group, &info->lma_groups, link, group_temp) + bin_group_destroy(group); + + TAILQ_FOREACH_SAFE(group, &info->vma_groups, link, group_temp) + bin_group_destroy(group); +} + static void bin_objfmt_output(yasm_object *object, FILE *f, /*@unused@*/ int all_syms, yasm_errwarns *errwarns) { - /*@observer@*/ /*@null@*/ yasm_section *text, *data, *bss, *prevsect; - /*@null@*/ yasm_expr *startexpr; - /*@dependent@*/ /*@null@*/ const yasm_intnum *startnum; - unsigned long start = 0, textstart = 0, datastart = 0; - unsigned long textlen = 0, textpad = 0, datalen = 0, datapad = 0; - unsigned long *prevsectlenptr, *prevsectpadptr; - unsigned long i; + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; bin_objfmt_output_info info; + bin_group *group, *lma_group, *vma_group, *group_temp; + yasm_intnum *start, *last, *vdelta; + bin_groups unsorted_groups, bss_groups; + + /* Set ORG to 0 unless otherwise specified */ + if (objfmt_bin->org) { + info.origin = yasm_expr_get_intnum(&objfmt_bin->org, 0); + if (!info.origin) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("ORG expression is too complex")); + yasm_errwarn_propagate(errwarns, objfmt_bin->org->line); + return; + } + if (yasm_intnum_sign(info.origin) < 0) { + yasm_error_set(YASM_ERROR_VALUE, N_("ORG expression is negative")); + yasm_errwarn_propagate(errwarns, objfmt_bin->org->line); + return; + } + info.origin = yasm_intnum_copy(info.origin); + } else + info.origin = yasm_intnum_create_uint(0); info.object = object; info.errwarns = errwarns; info.f = f; info.buf = yasm_xmalloc(REGULAR_OUTBUF_SIZE); + info.tmp_intn = yasm_intnum_create_uint(0); + TAILQ_INIT(&info.lma_groups); + TAILQ_INIT(&info.vma_groups); /* Check symbol table */ yasm_symtab_traverse(object->symtab, &info, bin_objfmt_check_sym); - text = yasm_object_find_general(object, ".text"); - data = yasm_object_find_general(object, ".data"); - bss = yasm_object_find_general(object, ".bss"); + /* Create section groups */ + if (yasm_object_sections_traverse(object, &info, bin_lma_create_group)) { + bin_objfmt_cleanup(&info); + return; /* error detected */ + } + + /* Determine section order according to LMA. + * Sections can be ordered either by (priority): + * - follows + * - start + * - progbits/nobits setting + * - order in the input file + */ - if (!text) - yasm_internal_error(N_("No `.text' section in bin objfmt output")); + /* Look at each group with follows specified, and find the section + * that group is supposed to follow. + */ + TAILQ_FOREACH_SAFE(lma_group, &info.lma_groups, link, group_temp) { + if (lma_group->bsd->follows) { + bin_group *found; + /* Need to find group containing section this section follows. */ + found = + find_group_by_name(&info.lma_groups, lma_group->bsd->follows); + if (!found) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' follows an invalid or unknown section `%s'"), + yasm_section_get_name(lma_group->section), + lma_group->bsd->follows); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Check for loops */ + if (lma_group->section == found->section || + find_group_by_section(&lma_group->follow_groups, + found->section)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("follows loop between section `%s' and section `%s'"), + yasm_section_get_name(lma_group->section), + yasm_section_get_name(found->section)); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Remove this section from main lma groups list */ + TAILQ_REMOVE(&info.lma_groups, lma_group, link); + /* Add it after the section it's supposed to follow. */ + TAILQ_INSERT_TAIL(&found->follow_groups, lma_group, link); + } + } - /* First determine the actual starting offsets for .data and .bss. - * As the order in the file is .text -> .data -> .bss (not present), - * use the last bytecode in .text (and the .text section start) to - * determine the starting offset in .data, and likewise for .bss. - * Also compensate properly for alignment. + /* Sort the top-level groups according to their start address. + * Use Shell sort for ease of implementation. + * If no start address is specified for a section, don't change the order, + * and move BSS sections to a separate list so they can be moved to the + * end of the lma list after all other sections are sorted. */ + unsorted_groups = info.lma_groups; /* structure copy */ + TAILQ_INIT(&info.lma_groups); + TAILQ_INIT(&bss_groups); + TAILQ_FOREACH_SAFE(lma_group, &unsorted_groups, link, group_temp) { + bin_group *before; + + if (!lma_group->bsd->istart) { + if (lma_group->bsd->bss) + TAILQ_INSERT_TAIL(&bss_groups, lma_group, link); + else + TAILQ_INSERT_TAIL(&info.lma_groups, lma_group, link); + continue; + } - /* Find out the start of .text */ - startexpr = yasm_expr_copy(yasm_section_get_start(text)); - assert(startexpr != NULL); - startnum = yasm_expr_get_intnum(&startexpr, 0); - if (!startnum) { - yasm_error_set(YASM_ERROR_TOO_COMPLEX, - N_("ORG expression too complex")); - yasm_errwarn_propagate(errwarns, startexpr->line); - return; + before = NULL; + TAILQ_FOREACH(group, &info.lma_groups, link) { + if (!group->bsd->istart) + continue; + if (yasm_intnum_compare(group->bsd->istart, + lma_group->bsd->istart) > 0) { + before = group; + break; + } + } + if (before) + TAILQ_INSERT_BEFORE(before, lma_group, link); + else + TAILQ_INSERT_TAIL(&info.lma_groups, lma_group, link); } - start = yasm_intnum_get_uint(startnum); - yasm_expr_destroy(startexpr); - info.abs_start = start; - textstart = start; - - /* Align .data and .bss (if present) by adjusting their starts. */ - prevsect = text; - prevsectlenptr = &textlen; - prevsectpadptr = &textpad; - if (data) { - start = bin_objfmt_align_section(data, prevsect, start, - prevsectlenptr, prevsectpadptr); - yasm_section_set_start(data, yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), 0), 0); - datastart = start; - prevsect = data; - prevsectlenptr = &datalen; - prevsectpadptr = &datapad; - } - if (bss) { - start = bin_objfmt_align_section(bss, prevsect, start, - prevsectlenptr, prevsectpadptr); - yasm_section_set_start(bss, yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), 0), 0); - } - - /* Output .text first. */ - info.sect = text; - info.start = textstart; - yasm_section_bcs_traverse(text, errwarns, &info, - bin_objfmt_output_bytecode); - - /* If .data is present, output it */ - if (data) { - /* Add padding to align .data. Just use a for loop, as this will - * seldom be very many bytes. - */ - for (i=0; ibsd->istart) + yasm_intnum_set(start, lma_group->bsd->istart); + group_assign_start_recurse(lma_group, start, last, vdelta, + info.tmp_intn, errwarns); + yasm_intnum_set(start, last); } + yasm_intnum_destroy(last); + yasm_intnum_destroy(vdelta); + + /* + * Determine section order according to VMA + */ - /* If .bss is present, check it for non-reserve bytecodes */ + /* Create section groups */ + if (yasm_object_sections_traverse(object, &info, bin_vma_create_group)) { + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); + return; /* error detected */ + } + + /* Look at each group with vfollows specified, and find the section + * that group is supposed to follow. + */ + TAILQ_FOREACH_SAFE(vma_group, &info.vma_groups, link, group_temp) { + if (vma_group->bsd->vfollows) { + bin_group *found; + /* Need to find group containing section this section follows. */ + found = find_group_by_name(&info.vma_groups, + vma_group->bsd->vfollows); + if (!found) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' vfollows an invalid or unknown section `%s'"), + yasm_section_get_name(vma_group->section), + vma_group->bsd->vfollows); + yasm_errwarn_propagate(errwarns, 0); + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); + return; + } + + /* Check for loops */ + if (vma_group->section == found->section || + find_group_by_section(&vma_group->follow_groups, + found->section)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("vfollows loop between section `%s' and section `%s'"), + yasm_section_get_name(vma_group->section), + yasm_section_get_name(found->section)); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Remove this section from main lma groups list */ + TAILQ_REMOVE(&info.vma_groups, vma_group, link); + /* Add it after the section it's supposed to follow. */ + TAILQ_INSERT_TAIL(&found->follow_groups, vma_group, link); + } + } + + /* Due to the combination of steps above, we now know that all top-level + * groups have integer ivstart: + * Vstart Vfollows Valign Handled by + * No No No group_assign_start_recurse() + * No No Yes group_assign_start_recurse() + * No Yes - vfollows loop (above) + * Yes - - bin_lma_create_group() + */ + TAILQ_FOREACH(vma_group, &info.vma_groups, link) { + yasm_intnum_set(start, vma_group->bsd->ivstart); + group_assign_vstart_recurse(vma_group, start, errwarns); + } + + /* Output map file */ + output_map(&info); + + /* Ensure we don't have overlapping progbits LMAs. + * Use a dumb O(N^2) algorithm as the number of sections is essentially + * always low. + */ + if (yasm_object_sections_traverse(object, NULL, check_lma_overlap)) { + yasm_errwarn_propagate(errwarns, 0); + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); + return; + } + /* Output sections */ + yasm_object_sections_traverse(object, &info, bin_objfmt_output_section); - yasm_xfree(info.buf); + /* Clean up */ + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); } static void bin_objfmt_destroy(yasm_objfmt *objfmt) { + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)objfmt; + if (objfmt_bin->map_filename) + yasm_xfree(objfmt_bin->map_filename); + yasm_expr_destroy(objfmt_bin->org); yasm_xfree(objfmt); } static void +define_section_symbol(yasm_symtab *symtab, yasm_section *sect, + const char *sectname, const char *suffix, + enum bin_ssym which, unsigned long line) +{ + yasm_symrec *sym; + bin_symrec_data *bsymd = yasm_xmalloc(sizeof(bin_symrec_data)); + char *symname = yasm_xmalloc(8+strlen(sectname)+strlen(suffix)+1); + + strcpy(symname, "section."); + strcat(symname, sectname); + strcat(symname, suffix); + + bsymd->section = sect; + bsymd->which = which; + + sym = yasm_symtab_declare(symtab, symname, YASM_SYM_EXTERN, line); + yasm_xfree(symname); + yasm_symrec_add_data(sym, &bin_symrec_data_cb, bsymd); +} + +static bin_section_data * bin_objfmt_init_new_section(yasm_object *object, yasm_section *sect, const char *sectname, unsigned long line) { - yasm_symtab_define_label(object->symtab, sectname, - yasm_section_bcs_first(sect), 1, line); + /*yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt;*/ + bin_section_data *data; + + data = yasm_xmalloc(sizeof(bin_section_data)); + data->bss = 0; + data->align = NULL; + data->valign = NULL; + data->start = NULL; + data->vstart = NULL; + data->follows = NULL; + data->vfollows = NULL; + data->istart = NULL; + data->ivstart = NULL; + data->length = NULL; + yasm_section_add_data(sect, &bin_section_data_cb, data); + + define_section_symbol(object->symtab, sect, sectname, ".start", + SSYM_START, line); + define_section_symbol(object->symtab, sect, sectname, ".vstart", + SSYM_VSTART, line); + define_section_symbol(object->symtab, sect, sectname, ".length", + SSYM_LENGTH, line); + + return data; } static yasm_section * @@ -382,7 +1412,7 @@ bin_objfmt_add_default_section(yasm_object *object) yasm_section *retval; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); if (isnew) { bin_objfmt_init_new_section(object, retval, ".text", 0); yasm_section_set_default(retval, 1); @@ -399,15 +1429,46 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, yasm_valparam *vp; yasm_section *retval; int isnew; - unsigned long start; + int flags_override = 0; const char *sectname; - int resonly = 0; - /*@only@*/ /*@null@*/ yasm_intnum *align_intn = NULL; - unsigned long align = 4; - int have_align = 0; + bin_section_data *bsd = NULL; + + struct bin_section_switch_data { + /*@only@*/ /*@null@*/ char *follows; + /*@only@*/ /*@null@*/ char *vfollows; + /*@only@*/ /*@null@*/ yasm_expr *start; + /*@only@*/ /*@null@*/ yasm_expr *vstart; + /*@only@*/ /*@null@*/ yasm_intnum *align; + /*@only@*/ /*@null@*/ yasm_intnum *valign; + unsigned long bss; + unsigned long code; + } data; static const yasm_dir_help help[] = { - { "align", 1, yasm_dir_helper_intn, 0, 0 } + { "follows", 1, yasm_dir_helper_string, + offsetof(struct bin_section_switch_data, follows), 0 }, + { "vfollows", 1, yasm_dir_helper_string, + offsetof(struct bin_section_switch_data, vfollows), 0 }, + { "start", 1, yasm_dir_helper_expr, + offsetof(struct bin_section_switch_data, start), 0 }, + { "vstart", 1, yasm_dir_helper_expr, + offsetof(struct bin_section_switch_data, vstart), 0 }, + { "align", 1, yasm_dir_helper_intn, + offsetof(struct bin_section_switch_data, align), 0 }, + { "valign", 1, yasm_dir_helper_intn, + offsetof(struct bin_section_switch_data, valign), 0 }, + { "nobits", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, bss), 1 }, + { "progbits", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, bss), 0 }, + { "code", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 1 }, + { "data", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 0 }, + { "execute", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 1 }, + { "noexecute", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 0 } }; vp = yasm_vps_first(valparams); @@ -416,31 +1477,48 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, return NULL; vp = yasm_vps_next(vp); - /* If it's the first section output (.text) start at 0, otherwise - * make sure the start is > 128. - */ - if (strcmp(sectname, ".text") == 0) - start = 0; - else if (strcmp(sectname, ".data") == 0) - start = 200; - else if (strcmp(sectname, ".bss") == 0) { - start = 200; - resonly = 1; + retval = yasm_object_find_general(object, sectname); + if (retval) { + bsd = yasm_section_get_data(retval, &bin_section_data_cb); + assert(bsd != NULL); + data.follows = bsd->follows; + data.vfollows = bsd->vfollows; + data.start = bsd->start; + data.vstart = bsd->vstart; + data.align = NULL; + data.valign = NULL; + data.bss = bsd->bss; + data.code = yasm_section_is_code(retval); } else { - /* other section names not recognized. */ + data.follows = NULL; + data.vfollows = NULL; + data.start = NULL; + data.vstart = NULL; + data.align = NULL; + data.valign = NULL; + data.bss = strcmp(sectname, ".bss") == 0; + data.code = strcmp(sectname, ".text") == 0; + } + + flags_override = yasm_dir_helper(object, vp, line, help, NELEMS(help), + &data, yasm_dir_helper_valparam_warn); + if (flags_override < 0) + return NULL; /* error occurred */ + + if (data.start && data.follows) { yasm_error_set(YASM_ERROR_GENERAL, - N_("segment name `%s' not recognized"), sectname); + N_("cannot combine `start' and `follows' section attributes")); return NULL; } - have_align = yasm_dir_helper(object, vp, line, help, NELEMS(help), - &align_intn, yasm_dir_helper_valparam_warn); - if (have_align < 0) - return NULL; /* error occurred */ + if (data.vstart && data.vfollows) { + yasm_error_set(YASM_ERROR_GENERAL, + N_("cannot combine `vstart' and `vfollows' section attributes")); + return NULL; + } - if (align_intn) { - align = yasm_intnum_get_uint(align_intn); - yasm_intnum_destroy(align_intn); + if (data.align) { + unsigned long align = yasm_intnum_get_uint(data.align); /* Alignments must be a power of two. */ if (!is_exp2(align)) { @@ -449,22 +1527,42 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, "align"); return NULL; } - } + } else + data.align = bsd ? bsd->align : NULL; + + if (data.valign) { + unsigned long valign = yasm_intnum_get_uint(data.valign); + + /* Alignments must be a power of two. */ + if (!is_exp2(valign)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("argument to `%s' is not a power of two"), + "valign"); + return NULL; + } + } else + data.valign = bsd ? bsd->valign : NULL; - retval = yasm_object_get_general(object, sectname, - yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), line), align, - strcmp(sectname, ".text") == 0, resonly, &isnew, line); + retval = yasm_object_get_general(object, sectname, 0, (int)data.code, + (int)data.bss, &isnew, line); if (isnew) - bin_objfmt_init_new_section(object, retval, sectname, line); + bsd = bin_objfmt_init_new_section(object, retval, sectname, line); + else + bsd = yasm_section_get_data(retval, &bin_section_data_cb); if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); - yasm_section_set_align(retval, align, line); - } else if (have_align) - yasm_warn_set(YASM_WARN_GENERAL, - N_("alignment value ignored on section redeclaration")); + } + + /* Update section flags */ + bsd->bss = data.bss; + bsd->align = data.align; + bsd->valign = data.valign; + bsd->start = data.start; + bsd->vstart = data.vstart; + bsd->follows = data.follows; + bsd->vfollows = data.vfollows; return retval; } @@ -475,25 +1573,181 @@ bin_objfmt_dir_org(yasm_object *object, /*@unused@*/ /*@null@*/ yasm_valparamhead *objext_valparams, unsigned long line) { - yasm_section *sect; + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; yasm_valparam *vp; - /*@only@*/ /*@null@*/ yasm_expr *start; - /* ORG takes just a simple integer as param */ + /* We only allow a single ORG in a program. */ + if (objfmt_bin->org) { + yasm_error_set(YASM_ERROR_GENERAL, N_("program origin redefined")); + return; + } + + /* ORG takes just a simple expression as param */ vp = yasm_vps_first(valparams); - start = yasm_vp_expr(vp, object->symtab, line); - if (!start) { + objfmt_bin->org = yasm_vp_expr(vp, object->symtab, line); + if (!objfmt_bin->org) { yasm_error_set(YASM_ERROR_SYNTAX, N_("argument to ORG must be expression")); return; } +} + +struct bin_dir_map_data { + unsigned long flags; + /*@only@*/ /*@null@*/ char *filename; +}; + +static int +dir_map_filename(void *obj, yasm_valparam *vp, unsigned long line, void *data) +{ + struct bin_dir_map_data *mdata = (struct bin_dir_map_data *)data; + const char *filename; + + if (mdata->filename) { + yasm_warn_set(YASM_WARN_GENERAL, N_("map file already specified")); + return 0; + } + + filename = yasm_vp_string(vp); + if (!filename) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("unexpected expression in [map]")); + return -1; + } + mdata->filename = yasm__xstrdup(filename); + + return 1; +} + +static void +bin_objfmt_dir_map(yasm_object *object, + /*@null@*/ yasm_valparamhead *valparams, + /*@unused@*/ /*@null@*/ + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; + + struct bin_dir_map_data data; + + static const yasm_dir_help help[] = { + { "all", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), + MAP_BRIEF|MAP_SECTIONS|MAP_SYMBOLS }, + { "brief", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_BRIEF }, + { "sections", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SECTIONS }, + { "segments", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SECTIONS }, + { "symbols", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SYMBOLS } + }; + + data.flags = objfmt_bin->map_flags | MAP_NONE; + data.filename = objfmt_bin->map_filename; - /* ORG changes the start of the .text section */ - sect = yasm_object_find_general(object, ".text"); - if (!sect) - yasm_internal_error( - N_("bin objfmt: .text section does not exist before ORG is called?")); - yasm_section_set_start(sect, start, line); + if (valparams && yasm_dir_helper(object, yasm_vps_first(valparams), line, help, + NELEMS(help), &data, dir_map_filename) < 0) + return; /* error occurred */ + + objfmt_bin->map_flags = data.flags; + objfmt_bin->map_filename = data.filename; +} + +static void +bin_section_data_destroy(void *data) +{ + bin_section_data *bsd = (bin_section_data *)data; + if (bsd->start) + yasm_expr_destroy(bsd->start); + if (bsd->vstart) + yasm_expr_destroy(bsd->vstart); + if (bsd->follows) + yasm_xfree(bsd->follows); + if (bsd->vfollows) + yasm_xfree(bsd->vfollows); + if (bsd->istart) + yasm_intnum_destroy(bsd->istart); + if (bsd->ivstart) + yasm_intnum_destroy(bsd->ivstart); + if (bsd->length) + yasm_intnum_destroy(bsd->length); + yasm_xfree(data); +} + +static void +bin_section_data_print(void *data, FILE *f, int indent_level) +{ + bin_section_data *bsd = (bin_section_data *)data; + + fprintf(f, "%*sbss=%d\n", indent_level, "", bsd->bss); + + fprintf(f, "%*salign=", indent_level, ""); + if (bsd->align) + yasm_intnum_print(bsd->align, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*svalign=", indent_level, ""); + if (bsd->valign) + yasm_intnum_print(bsd->valign, f); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*sstart=", indent_level, ""); + yasm_expr_print(bsd->start, f); + fprintf(f, "\n%*svstart=", indent_level, ""); + yasm_expr_print(bsd->vstart, f); + + fprintf(f, "\n%*sfollows=", indent_level, ""); + if (bsd->follows) + fprintf(f, "\"%s\"", bsd->follows); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*svfollows=", indent_level, ""); + if (bsd->vfollows) + fprintf(f, "\"%s\"", bsd->vfollows); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*sistart=", indent_level, ""); + if (bsd->istart) + yasm_intnum_print(bsd->istart, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*sivstart=", indent_level, ""); + if (bsd->ivstart) + yasm_intnum_print(bsd->ivstart, f); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*slength=", indent_level, ""); + if (bsd->length) + yasm_intnum_print(bsd->length, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n"); +} + +static void +bin_symrec_data_destroy(void *data) +{ + yasm_xfree(data); +} + +static void +bin_symrec_data_print(void *data, FILE *f, int indent_level) +{ + bin_symrec_data *bsymd = (bin_symrec_data *)data; + + fprintf(f, "%*ssection=\"%s\"\n", indent_level, "", + yasm_section_get_name(bsymd->section)); + fprintf(f, "%*swhich=", indent_level, ""); + switch (bsymd->which) { + case SSYM_START: fprintf(f, "START"); break; + case SSYM_VSTART: fprintf(f, "VSTART"); break; + case SSYM_LENGTH: fprintf(f, "LENGTH"); break; + } + fprintf(f, "\n"); } @@ -505,6 +1759,7 @@ static const char *bin_objfmt_dbgfmt_keywords[] = { static const yasm_directive bin_objfmt_directives[] = { { "org", "nasm", bin_objfmt_dir_org, YASM_DIR_ARG_REQUIRED }, + { "map", "nasm", bin_objfmt_dir_map, YASM_DIR_ANY }, { NULL, NULL, NULL, 0 } }; diff --git a/modules/objfmts/bin/tests/Makefile.inc b/modules/objfmts/bin/tests/Makefile.inc index e1993ea4..92b85ff6 100644 --- a/modules/objfmts/bin/tests/Makefile.inc +++ b/modules/objfmts/bin/tests/Makefile.inc @@ -30,3 +30,7 @@ EXTRA_DIST += modules/objfmts/bin/tests/reserve.hex EXTRA_DIST += modules/objfmts/bin/tests/reserve.errwarn EXTRA_DIST += modules/objfmts/bin/tests/shr.asm EXTRA_DIST += modules/objfmts/bin/tests/shr.hex + +EXTRA_DIST += modules/objfmts/bin/tests/multisect/Makefile.inc + +include modules/objfmts/bin/tests/multisect/Makefile.inc diff --git a/modules/objfmts/bin/tests/multisect/Makefile.inc b/modules/objfmts/bin/tests/multisect/Makefile.inc new file mode 100644 index 00000000..93c1423b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/Makefile.inc @@ -0,0 +1,53 @@ +# $Id$ + +TESTS += modules/objfmts/bin/tests/multisect/bin_multi_test.sh + +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin_multi_test.sh +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop1-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop2-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-notfound-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn + diff --git a/modules/objfmts/bin/tests/multisect/bin-align.asm b/modules/objfmts/bin/tests/multisect/bin-align.asm new file mode 100644 index 00000000..e355aac7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.asm @@ -0,0 +1,12 @@ +[map all binalign.map] +section .text +db 1 +align 8 +db 0 +section .data +align 8 +db 0 +section .foo align=4 +align 8 +section .bar valign=4 +align 8 diff --git a/modules/objfmts/bin/tests/multisect/bin-align.errwarn b/modules/objfmts/bin/tests/multisect/bin-align.errwarn new file mode 100644 index 00000000..e13f89df --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.errwarn @@ -0,0 +1,3 @@ +-: warning: section `.foo' internal align of 8 is greater than `align' of 4; using `align' +-: warning: section `.bar' internal align of 8 is greater than `valign' of 4; using `valign' +-:1: warning: map file already specified diff --git a/modules/objfmts/bin/tests/multisect/bin-align.hex b/modules/objfmts/bin/tests/multisect/bin-align.hex new file mode 100644 index 00000000..dd133f77 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.hex @@ -0,0 +1,17 @@ +01 +8d +74 +00 +8d +bd +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/bin-align.map b/modules/objfmts/bin/tests/multisect/bin-align.map new file mode 100644 index 00000000..3031bd15 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.map @@ -0,0 +1,66 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/bin-align + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000009 00000000 00000009 00000009 progbits .text +00000010 00000011 00000010 00000011 00000001 progbits .data +00000014 00000014 00000014 00000014 00000000 progbits .foo +00000018 00000018 00000018 00000018 00000000 progbits .bar + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000009 +start: 00000000 +align: 00000008 +follows: not defined +vstart: 00000000 +valign: 00000008 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000001 +start: 00000010 +align: 00000008 +follows: not defined +vstart: 00000010 +valign: 00000008 +vfollows: not defined + +---- Section .foo ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 00000014 +align: 00000004 +follows: not defined +vstart: 00000014 +valign: 00000004 +vfollows: not defined + +---- Section .bar ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 00000018 +align: 00000008 +follows: not defined +vstart: 00000018 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.asm b/modules/objfmts/bin/tests/multisect/bin-ssym.asm new file mode 100644 index 00000000..8c5608cf --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.asm @@ -0,0 +1,5 @@ +section foo start=0x10 vstart=0x6000 +mov si, section.foo.start +mov di, section.foo.vstart +mov cx, section.foo.length +;mov dx, section.foo.vstart-section.foo.start diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.hex b/modules/objfmts/bin/tests/multisect/bin-ssym.hex new file mode 100644 index 00000000..e89a7e22 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.hex @@ -0,0 +1,25 @@ +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +be +10 +00 +bf +00 +60 +b9 +09 +00 diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.map b/modules/objfmts/bin/tests/multisect/bin-ssym.map new file mode 100644 index 00000000..9ddfe168 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.map @@ -0,0 +1,16 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/bin-ssym + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00006000 00006009 00000010 00000019 00000009 progbits foo + diff --git a/modules/objfmts/bin/tests/multisect/bin_multi_test.sh b/modules/objfmts/bin/tests/multisect/bin_multi_test.sh new file mode 100755 index 00000000..1c0f7628 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin_multi_test.sh @@ -0,0 +1,114 @@ +#! /bin/sh +# $Id$ + +YASM_TEST_SUITE=1 +export YASM_TEST_SUITE + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +mkdir results >/dev/null 2>&1 + +# +# Verify that all test cases match +# + +passedct=0 +failedct=0 + +echo $ECHO_N "Test bin_multi_test: $ECHO_C" +for asm in ${srcdir}/modules/objfmts/bin/tests/multisect/*.asm +do + a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'` + o=${a} + oh=${a}.hx + og=`echo ${asm} | sed 's,.asm$,.hex,'` + e=${a}.ew + eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` + m=${a}.map + mg=`echo ${asm} | sed 's,.asm$,.map,'` + if test \! -e ${eg}; then + eg=/dev/null + fi + + # Run within a subshell to prevent signal messages from displaying. + sh -c "cat ${asm} | ./yasm -f bin --mapfile=results/${m} -o results/${o} - 2>results/${e}" >/dev/null 2>/dev/null + status=$? + if test $status -gt 128; then + # We should never get a coredump! + echo $ECHO_N "C$ECHO_C" + eval "failed$failedct='C: ${a} crashed!'" + failedct=`expr $failedct + 1` + elif test $status -gt 0; then + echo ${asm} | grep err >/dev/null + if test $? -gt 0; then + # YASM detected errors but shouldn't have! + echo $ECHO_N "E$ECHO_C" + eval "failed$failedct='E: ${a} returned an error code!'" + failedct=`expr $failedct + 1` + else + # We got errors, check to see if they match: + if diff -w ${eg} results/${e} >/dev/null; then + # Error/warnings match, it passes! + echo $ECHO_N ".$ECHO_C" + passedct=`expr $passedct + 1` + else + # Error/warnings don't match. + echo $ECHO_N "W$ECHO_C" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + fi + fi + else + echo ${asm} | grep -v err >/dev/null + if test $? -gt 0; then + # YASM didn't detect errors but should have! + echo $ECHO_N "E$ECHO_C" + eval "failed$failedct='E: ${a} did not return an error code!'" + failedct=`expr $failedct + 1` + else + ./test_hd results/${o} > results/${oh} + if diff ${og} results/${oh} >/dev/null; then + if diff -w ${eg} results/${e} >/dev/null; then + if diff -w ${mg} results/${m} >/dev/null; then + # All match, it passes! + echo $ECHO_N ".$ECHO_C" + passedct=`expr $passedct + 1` + else + # Map file doesn't match. + echo $ECHO_N "M$ECHO_C" + eval "failed$failedct='M: ${a} did not match map file!'" + failedct=`expr $failedct + 1` + fi + else + # Error/warnings don't match. + echo $ECHO_N "W$ECHO_C" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + fi + else + # Object file doesn't match. + echo $ECHO_N "O$ECHO_C" + eval "failed$failedct='O: ${a} did not match object file!'" + failedct=`expr $failedct + 1` + fi + fi + fi +done + +ct=`expr $failedct + $passedct` +per=`expr 100 \* $passedct / $ct` + +echo " +$passedct-$failedct/$ct $per%" +i=0 +while test $i -lt $failedct; do + eval "failure=\$failed$i" + echo " ** $failure" + i=`expr $i + 1` +done + +exit $failedct diff --git a/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm b/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm new file mode 100644 index 00000000..ad7fef16 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm @@ -0,0 +1,2 @@ +section sect1 follows=sect2 +section sect2 follows=sect1 diff --git a/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn new file mode 100644 index 00000000..c7ba6a5a --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn @@ -0,0 +1 @@ +-: follows loop between section `sect2' and section `sect1' diff --git a/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm b/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm new file mode 100644 index 00000000..9b15f465 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm @@ -0,0 +1 @@ +section sect follows=sect diff --git a/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn new file mode 100644 index 00000000..f4f46dd9 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn @@ -0,0 +1 @@ +-: follows loop between section `sect' and section `sect' diff --git a/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm b/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm new file mode 100644 index 00000000..36361d52 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm @@ -0,0 +1,2 @@ +section foo follows=bar + diff --git a/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn new file mode 100644 index 00000000..85234767 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn @@ -0,0 +1 @@ +-: section `foo' follows an invalid or unknown section `bar' diff --git a/modules/objfmts/bin/tests/multisect/initbss.asm b/modules/objfmts/bin/tests/multisect/initbss.asm new file mode 100644 index 00000000..8fe39bcc --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.asm @@ -0,0 +1,5 @@ +section .bss +mov ax, 5 + +section foo nobits +db 5 diff --git a/modules/objfmts/bin/tests/multisect/initbss.errwarn b/modules/objfmts/bin/tests/multisect/initbss.errwarn new file mode 100644 index 00000000..e92a68e4 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.errwarn @@ -0,0 +1,2 @@ +-:2: warning: initialized space declared in nobits section: ignoring +-:5: warning: initialized space declared in nobits section: ignoring diff --git a/modules/objfmts/bin/tests/multisect/initbss.hex b/modules/objfmts/bin/tests/multisect/initbss.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/objfmts/bin/tests/multisect/initbss.map b/modules/objfmts/bin/tests/multisect/initbss.map new file mode 100644 index 00000000..d26734de --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.map @@ -0,0 +1,17 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/initbss + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00000000 00000003 00000000 00000003 00000003 nobits .bss +00000004 00000005 00000004 00000005 00000001 nobits foo + diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm b/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm new file mode 100644 index 00000000..2beae7c7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm @@ -0,0 +1,102 @@ +[map all] +BSS_START equ 0800h +LATEBSS_START equ 0B800h +TEXT_START equ 7C00h +STACK_SIZE equ 4096 +STACK_START equ TEXT_START-STACK_SIZE +org TEXT_START +[section .text] +times 0x2410 db 0x1 +[section .earlybss nobits start=BSS_START] +resb 0x40C4 +[section .bcopy32 align=4 valign=16 follows=.data vfollows=.earlybss] +times 0x2A0 db 0x3 +[section .config align=4 valign=16 follows=.bcopy32 vfollows=.bcopy32] +times 0x23 db 0x4 +[section .config.end nobits valign=4 vfollows=.config] +[section .bss1 nobits valign=16 vfollows=.config.end] +resb 0x1FB +[section .text start=TEXT_START] +[section .data align=16] +times 0x590 db 0x2 +[section .adv progbits align=1 follows=.config] +[section .bss nobits align=16 follows=.adv] +resb 0x3900 +[section .stack nobits align=16 start=STACK_START] +resb STACK_SIZE +[section .stack nobits align=16 start=STACK_START] +[section .stack nobits align=16 start=STACK_START] +[section .earlybss] +[section .bss] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .text] +[section .text] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .bss] +[section .text] +[section .data] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .data] +[section .bss1] +[section .data] +[section .text] +[section .bss1] +[section .text] +[section .text] +[section .data] +[section .text] +[section .text] +[section .bss] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .text] +[section .text] +[section .bss1] +[section .data] +[section .text] +[section .text] +[section .data] +[section .config] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .data] +[section .text] +[section .data] +[section .config] +[section .bss] +[section .text] +[section .text] +[section .data] +[section .bss] +[section .bcopy32] +[section .data] +[section .bcopy32] +[section .earlybss] +[section .text] +[section .text] +[section .bss] +[section .data] +[section .bss1] +[section .text] +[section .data] +[section .bss1] +[section .text] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .bss] +[section .data] diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex b/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex new file mode 100644 index 00000000..bb591fc0 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex @@ -0,0 +1,11363 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.map b/modules/objfmts/bin/tests/multisect/ldlinux-sects.map new file mode 100644 index 00000000..03fde845 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.map @@ -0,0 +1,148 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/ldlinux-sects + +-- Program origin ------------------------------------------------------------- + +00007C00 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000800 000048C4 00000800 000048C4 000040C4 nobits .earlybss +00006C00 00007C00 00006C00 00007C00 00001000 nobits .stack +00007C00 0000A010 00007C00 0000A010 00002410 progbits .text +0000A010 0000A5A0 0000A010 0000A5A0 00000590 progbits .data +000048D0 00004B70 0000A5A0 0000A840 000002A0 progbits .bcopy32 +00004B70 00004B93 0000A840 0000A863 00000023 progbits .config +0000A863 0000A863 0000A863 0000A863 00000000 progbits .adv +0000A870 0000E170 0000A870 0000E170 00003900 nobits .bss +00004B94 00004B94 0000E170 0000E170 00000000 nobits .config.end +00004BA0 00004D9B 0000E170 0000E36B 000001FB nobits .bss1 + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .earlybss -------------------------------------------------------- + +class: nobits +length: 000040C4 +start: 00000800 +align: 00000004 +follows: not defined +vstart: 00000800 +valign: 00000004 +vfollows: not defined + +---- Section .stack ----------------------------------------------------------- + +class: nobits +length: 00001000 +start: 00006C00 +align: 00000010 +follows: not defined +vstart: 00006C00 +valign: 00000010 +vfollows: not defined + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00002410 +start: 00007C00 +align: 00000004 +follows: not defined +vstart: 00007C00 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000590 +start: 0000A010 +align: 00000010 +follows: not defined +vstart: 0000A010 +valign: 00000010 +vfollows: not defined + +---- Section .bcopy32 --------------------------------------------------------- + +class: progbits +length: 000002A0 +start: 0000A5A0 +align: 00000004 +follows: .data +vstart: 000048D0 +valign: 00000010 +vfollows: .earlybss + +---- Section .config ---------------------------------------------------------- + +class: progbits +length: 00000023 +start: 0000A840 +align: 00000004 +follows: .bcopy32 +vstart: 00004B70 +valign: 00000010 +vfollows: .bcopy32 + +---- Section .adv ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 0000A863 +align: 00000001 +follows: .config +vstart: 0000A863 +valign: 00000001 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00003900 +start: 0000A870 +align: 00000010 +follows: .adv +vstart: 0000A870 +valign: 00000010 +vfollows: not defined + +---- Section .config.end ------------------------------------------------------ + +class: nobits +length: 00000000 +start: 0000E170 +align: 00000004 +follows: not defined +vstart: 00004B94 +valign: 00000004 +vfollows: .config + +---- Section .bss1 ------------------------------------------------------------ + +class: nobits +length: 000001FB +start: 0000E170 +align: 00000004 +follows: not defined +vstart: 00004BA0 +valign: 00000010 +vfollows: .config.end + +-- Symbols -------------------------------------------------------------------- + +---- No Section --------------------------------------------------------------- + +Value Name +00000800 BSS_START +0000B800 LATEBSS_START +00007C00 TEXT_START +00001000 STACK_SIZE +00006C00 STACK_START + + diff --git a/modules/objfmts/bin/tests/multisect/multisect1.asm b/modules/objfmts/bin/tests/multisect/multisect1.asm new file mode 100644 index 00000000..2989b15b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.asm @@ -0,0 +1,31 @@ +BITS 32 + +[MAP all] +; This file is loaded as a DOS .COM file. +SEGMENT _TEXT start=0 vstart=100h + +; shrink & relocate stack: + mov sp, stack_ends ; NASM puts 460h here - + ; 9B0h is desired. + mov bx, sp + mov cl, 4 + shr bx, cl + mov ah, 4Ah ; DOS resize mem.block + int 21h + +SEGMENT GATESEG align=1 follows=_TEXT vstart=0 +; label to use for copying this segment at run-time. +gate0cpy: +dd 0 + +; 32-bit ring-0 protected mode code that interacts +; with the VMM (Win3.x/9x kernel). To be relocated +; at run-time to memory dynamically allocated with +; DPMI, and called through a call-gate from ring-3. +; vstart=0 makes some calculations easier. + +; Reserve space for stack: +SEGMENT .bss follows=GATESEG align=16 + resb 400h +stack_ends: + diff --git a/modules/objfmts/bin/tests/multisect/multisect1.hex b/modules/objfmts/bin/tests/multisect/multisect1.hex new file mode 100644 index 00000000..32695b89 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.hex @@ -0,0 +1,20 @@ +66 +bc +20 +04 +66 +89 +e3 +b1 +04 +66 +d3 +eb +b4 +4a +cd +21 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect1.map b/modules/objfmts/bin/tests/multisect/multisect1.map new file mode 100644 index 00000000..68cb155e --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.map @@ -0,0 +1,78 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/multisect1 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00000100 00000110 00000000 00000010 00000010 progbits _TEXT +00000000 00000004 00000010 00000014 00000004 progbits GATESEG +00000020 00000420 00000020 00000420 00000400 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section _TEXT ------------------------------------------------------------ + +class: progbits +length: 00000010 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section GATESEG ---------------------------------------------------------- + +class: progbits +length: 00000004 +start: 00000010 +align: 00000001 +follows: _TEXT +vstart: 00000000 +valign: 00000001 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000400 +start: 00000020 +align: 00000010 +follows: GATESEG +vstart: 00000020 +valign: 00000010 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + +---- Section GATESEG ---------------------------------------------------------- + +Real Virtual Name +00000010 00000000 gate0cpy + + +---- Section .bss ------------------------------------------------------------- + +Real Virtual Name +00000020 00000020 stack_ends + + diff --git a/modules/objfmts/bin/tests/multisect/multisect2.asm b/modules/objfmts/bin/tests/multisect/multisect2.asm new file mode 100644 index 00000000..cfbf58c6 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.asm @@ -0,0 +1,42 @@ +org 100h +[map all] + +section .bss ; follows=.data + buffer resb 123h +section .data + msg db "this is a message", 0 +section .text + mov ax, msg + call showax + mov ax, buffer + call showax + ret + +;----------------- +showax: + push cx + push dx + + mov cx, 4 ; four digits to show + +.top + rol ax, 4 ; rotate one digit into position + mov dl, al ; make a copy to process + and dl, 0Fh ; mask off a single (hex) digit + cmp dl, 9 ; is it in the "A" to "F" range? + jbe .dec_dig ; no, skip it + add dl, 7 ; adjust +.dec_dig: + add dl, 30h ; convert to character + + push ax + mov ah, 2 + int 21h + pop ax + + loop .top + + pop dx + pop cx + ret +;-------------------------- diff --git a/modules/objfmts/bin/tests/multisect/multisect2.hex b/modules/objfmts/bin/tests/multisect/multisect2.hex new file mode 100644 index 00000000..f043f372 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.hex @@ -0,0 +1,66 @@ +b8 +30 +01 +e8 +07 +00 +b8 +44 +01 +e8 +01 +00 +c3 +51 +52 +b9 +04 +00 +c1 +c0 +04 +88 +c2 +80 +e2 +0f +80 +fa +09 +76 +03 +80 +c2 +07 +80 +c2 +30 +50 +b4 +02 +cd +21 +58 +e2 +e5 +5a +59 +c3 +74 +68 +69 +73 +20 +69 +73 +20 +61 +20 +6d +65 +73 +73 +61 +67 +65 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect2.map b/modules/objfmts/bin/tests/multisect/multisect2.map new file mode 100644 index 00000000..b3cb273e --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.map @@ -0,0 +1,74 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/multisect2 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000130 00000100 00000130 00000030 progbits .text +00000130 00000142 00000130 00000142 00000012 progbits .data +00000144 00000267 00000144 00000267 00000123 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000030 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000012 +start: 00000130 +align: 00000004 +follows: not defined +vstart: 00000130 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000123 +start: 00000144 +align: 00000004 +follows: not defined +vstart: 00000144 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +Real Virtual Name +0000010C 0000010C showax +0000010F 0000010F showax.top +0000011F 0000011F showax.dec_dig + + +---- Section .data ------------------------------------------------------------ + +Real Virtual Name +00000130 00000130 msg + + +---- Section .bss ------------------------------------------------------------- + +Real Virtual Name +00000144 00000144 buffer + + diff --git a/modules/objfmts/bin/tests/multisect/multisect3.asm b/modules/objfmts/bin/tests/multisect/multisect3.asm new file mode 100644 index 00000000..d6499f96 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.asm @@ -0,0 +1,9 @@ +[map all] +section .text + mov ax, bx + +section .foo nobits follows=.text + resb 4 + +section .bss + resb 4 diff --git a/modules/objfmts/bin/tests/multisect/multisect3.hex b/modules/objfmts/bin/tests/multisect/multisect3.hex new file mode 100644 index 00000000..a9949757 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.hex @@ -0,0 +1,2 @@ +89 +d8 diff --git a/modules/objfmts/bin/tests/multisect/multisect3.map b/modules/objfmts/bin/tests/multisect/multisect3.map new file mode 100644 index 00000000..1c67c227 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/multisect3 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000002 00000000 00000002 00000002 progbits .text +00000004 00000008 00000004 00000008 00000004 nobits .foo +00000008 0000000C 00000008 0000000C 00000004 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000002 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section .foo ------------------------------------------------------------- + +class: nobits +length: 00000004 +start: 00000004 +align: 00000004 +follows: .text +vstart: 00000004 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000004 +start: 00000008 +align: 00000004 +follows: not defined +vstart: 00000008 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/multisect4.asm b/modules/objfmts/bin/tests/multisect/multisect4.asm new file mode 100644 index 00000000..94d2415f --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.asm @@ -0,0 +1,31 @@ +[map all] +; Memory below 0800h is reserved for the BIOS and the MBR +BSS_START equ 0800h + +; PXELINUX needs lots of BSS, so it relocates itself on startup +;%if IS_PXELINUX +TEXT_START equ 9000h +;%else +;TEXT_START equ 7C00h +;%endif + +; +; The various sections and their relationship +; +org TEXT_START + +times 0x100 db 0x3 + +section .earlybss nobits start=BSS_START +resb 0x100 +section .bcopy32 align=16 follows=.data vfollows=.earlybss +times 0x100 db 0x1 +section .bss nobits align=256 vfollows=.bcopy32 +resb 0x100 + +section .text start=TEXT_START +section .data align=16 follows=.text +times 0x100 db 0x2 + +section .latebss nobits align=16 follows=.bcopy32 +resb 0x100 diff --git a/modules/objfmts/bin/tests/multisect/multisect4.hex b/modules/objfmts/bin/tests/multisect/multisect4.hex new file mode 100644 index 00000000..d40d7a19 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.hex @@ -0,0 +1,768 @@ +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/multisect4.map b/modules/objfmts/bin/tests/multisect/multisect4.map new file mode 100644 index 00000000..e1940dc6 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.map @@ -0,0 +1,97 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/multisect4 + +-- Program origin ------------------------------------------------------------- + +00009000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000800 00000900 00000800 00000900 00000100 nobits .earlybss +00009000 00009100 00009000 00009100 00000100 progbits .text +00009100 00009200 00009100 00009200 00000100 progbits .data +00000900 00000A00 00009200 00009300 00000100 progbits .bcopy32 +00009300 00009400 00009300 00009400 00000100 nobits .latebss +00000A00 00000B00 00009400 00009500 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .earlybss -------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000800 +align: 00000004 +follows: not defined +vstart: 00000800 +valign: 00000004 +vfollows: not defined + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00009000 +align: 00000004 +follows: not defined +vstart: 00009000 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00009100 +align: 00000010 +follows: .text +vstart: 00009100 +valign: 00000010 +vfollows: not defined + +---- Section .bcopy32 --------------------------------------------------------- + +class: progbits +length: 00000100 +start: 00009200 +align: 00000010 +follows: .data +vstart: 00000900 +valign: 00000010 +vfollows: .earlybss + +---- Section .latebss --------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00009300 +align: 00000010 +follows: .bcopy32 +vstart: 00009300 +valign: 00000010 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00009400 +align: 00000100 +follows: not defined +vstart: 00000A00 +valign: 00000100 +vfollows: .bcopy32 + +-- Symbols -------------------------------------------------------------------- + +---- No Section --------------------------------------------------------------- + +Value Name +00000800 BSS_START +00009000 TEXT_START + + diff --git a/modules/objfmts/bin/tests/multisect/multisect5.asm b/modules/objfmts/bin/tests/multisect/multisect5.asm new file mode 100644 index 00000000..2b761172 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.asm @@ -0,0 +1,22 @@ +org 0x100 +[map all] +section sect1 start=0x100 vstart=0x2000 +times 0x100 db 0 +section sect2 follows=sect1 +times 0x100 db 0 + +section sect3 start=0x300 vstart=0x4000 +times 0x100 db 0 +section sect4 follows=sect3 +times 0x100 db 0 +section sect5 vfollows=sect3 +times 0x100 db 0 + +section sect6 start=0x600 vstart=0x6000 +times 0x11 db 0 +section sect7 follows=sect6 valign=16 +times 0x104 db 0 +section sect8 follows=sect7 valign=16 ; NASM bug - sect7 and sect8 overlap +times 0x100 db 0 + +section sect9 vfollows=sect8 diff --git a/modules/objfmts/bin/tests/multisect/multisect5.hex b/modules/objfmts/bin/tests/multisect/multisect5.hex new file mode 100644 index 00000000..a2776bc8 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.hex @@ -0,0 +1,1816 @@ +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect5.map b/modules/objfmts/bin/tests/multisect/multisect5.map new file mode 100644 index 00000000..4c052be6 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.map @@ -0,0 +1,138 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/multisect5 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000100 00000100 00000100 00000000 progbits .text +00002000 00002100 00000100 00000200 00000100 progbits sect1 +00000200 00000300 00000200 00000300 00000100 progbits sect2 +00004000 00004100 00000300 00000400 00000100 progbits sect3 +00000400 00000500 00000400 00000500 00000100 progbits sect4 +00004100 00004200 00000500 00000600 00000100 progbits sect5 +00006000 00006011 00000600 00000611 00000011 progbits sect6 +00000620 00000724 00000614 00000718 00000104 progbits sect7 +00000730 00000830 00000718 00000818 00000100 progbits sect8 +00000830 00000830 00000818 00000818 00000000 progbits sect9 + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section sect1 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00002000 +valign: 00000004 +vfollows: not defined + +---- Section sect2 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000200 +align: 00000004 +follows: sect1 +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +---- Section sect3 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000300 +align: 00000004 +follows: not defined +vstart: 00004000 +valign: 00000004 +vfollows: not defined + +---- Section sect4 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000400 +align: 00000004 +follows: sect3 +vstart: 00000400 +valign: 00000004 +vfollows: not defined + +---- Section sect5 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000500 +align: 00000004 +follows: not defined +vstart: 00004100 +valign: 00000004 +vfollows: sect3 + +---- Section sect6 ------------------------------------------------------------ + +class: progbits +length: 00000011 +start: 00000600 +align: 00000004 +follows: not defined +vstart: 00006000 +valign: 00000004 +vfollows: not defined + +---- Section sect7 ------------------------------------------------------------ + +class: progbits +length: 00000104 +start: 00000614 +align: 00000004 +follows: sect6 +vstart: 00000620 +valign: 00000010 +vfollows: not defined + +---- Section sect8 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000718 +align: 00000004 +follows: sect7 +vstart: 00000730 +valign: 00000010 +vfollows: not defined + +---- Section sect9 ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000818 +align: 00000004 +follows: not defined +vstart: 00000830 +valign: 00000004 +vfollows: sect8 + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.asm b/modules/objfmts/bin/tests/multisect/nomultisect1.asm new file mode 100644 index 00000000..5f720d84 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.asm @@ -0,0 +1,10 @@ +[map all] + +[section .bss] +resb 0x100 + +[section .data] +times 0x100 db 1 + +[section .text] +times 0x100 db 1 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.hex b/modules/objfmts/bin/tests/multisect/nomultisect1.hex new file mode 100644 index 00000000..59c9350b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.hex @@ -0,0 +1,512 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.map b/modules/objfmts/bin/tests/multisect/nomultisect1.map new file mode 100644 index 00000000..89974207 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/nomultisect1 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000100 00000000 00000100 00000100 progbits .text +00000100 00000200 00000100 00000200 00000100 progbits .data +00000200 00000300 00000200 00000300 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000200 +align: 00000004 +follows: not defined +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.asm b/modules/objfmts/bin/tests/multisect/nomultisect2.asm new file mode 100644 index 00000000..b97e40a7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.asm @@ -0,0 +1,12 @@ +org 0x100 + +[map all] + +[section .bss] +resb 0x100 + +[section .data] +times 0x100 db 1 + +[section .text] +times 0x100 db 1 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.hex b/modules/objfmts/bin/tests/multisect/nomultisect2.hex new file mode 100644 index 00000000..59c9350b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.hex @@ -0,0 +1,512 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.map b/modules/objfmts/bin/tests/multisect/nomultisect2.map new file mode 100644 index 00000000..cc6d9c87 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: results/nomultisect2 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000200 00000100 00000200 00000100 progbits .text +00000200 00000300 00000200 00000300 00000100 progbits .data +00000300 00000400 00000300 00000400 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000200 +align: 00000004 +follows: not defined +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000300 +align: 00000004 +follows: not defined +vstart: 00000300 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm new file mode 100644 index 00000000..84a7c1e4 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm @@ -0,0 +1,2 @@ +section sect1 vfollows=sect2 +section sect2 vfollows=sect1 diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn new file mode 100644 index 00000000..b7a9006d --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn @@ -0,0 +1 @@ +-: vfollows loop between section `sect2' and section `sect1' diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm new file mode 100644 index 00000000..ac080b85 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm @@ -0,0 +1 @@ +section sect vfollows=sect diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn new file mode 100644 index 00000000..d48bbc85 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn @@ -0,0 +1 @@ +-: vfollows loop between section `sect' and section `sect' diff --git a/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm new file mode 100644 index 00000000..fe0f6e5b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm @@ -0,0 +1,2 @@ +section foo vfollows=bar + diff --git a/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn new file mode 100644 index 00000000..ecbc97d4 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn @@ -0,0 +1 @@ +-: section `foo' vfollows an invalid or unknown section `bar' diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c index 52f1e4aa..9c69ad35 100644 --- a/modules/objfmts/coff/coff-objfmt.c +++ b/modules/objfmts/coff/coff-objfmt.c @@ -1253,7 +1253,7 @@ coff_objfmt_add_default_section(yasm_object *object) coff_section_data *csd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); if (isnew) { csd = coff_objfmt_init_new_section(object, retval, ".text", 0); csd->flags = COFF_STYP_TEXT; @@ -1534,7 +1534,7 @@ coff_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, realname[8] = '\0'; } - retval = yasm_object_get_general(object, realname, 0, align, iscode, + retval = yasm_object_get_general(object, realname, align, iscode, resonly, &isnew, line); if (isnew) @@ -1629,8 +1629,7 @@ dir_export(yasm_object *object, yasm_valparamhead *valparams, } /* Add to end of linker directives */ - sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, 0, &isnew, - line); + sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, &isnew, line); /* Initialize directive section if needed */ if (isnew) { @@ -2007,7 +2006,7 @@ dir_endproc_frame(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, * Add unwind info to end of .xdata section. */ - sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, 0, &isnew, line); + sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, &isnew, line); /* Initialize xdata section if needed */ if (isnew) { @@ -2032,7 +2031,7 @@ dir_endproc_frame(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, * Add function lookup to end of .pdata section. */ - sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, 0, &isnew, line); + sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, &isnew, line); /* Initialize pdata section if needed */ if (isnew) { diff --git a/modules/objfmts/dbg/dbg-objfmt.c b/modules/objfmts/dbg/dbg-objfmt.c index 8452a810..998dc4f2 100644 --- a/modules/objfmts/dbg/dbg-objfmt.c +++ b/modules/objfmts/dbg/dbg-objfmt.c @@ -96,9 +96,7 @@ dbg_objfmt_add_default_section(yasm_object *object) yasm_section *retval; int isnew; - retval = yasm_object_get_general(object, ".text", - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(200)), 0), - 0, 0, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 0, 0, 0, &isnew, 0); if (isnew) { fprintf(objfmt_dbg->dbgfile, "(new) "); yasm_symtab_define_label(object->symtab, ".text", @@ -130,9 +128,8 @@ dbg_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, fprintf(objfmt_dbg->dbgfile, "NULL\n"); return NULL; } - retval = yasm_object_get_general(object, yasm_vp_string(vp), - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(200)), - line), 0, 0, 0, &isnew, line); + retval = yasm_object_get_general(object, yasm_vp_string(vp), 0, 0, 0, + &isnew, line); if (isnew) { fprintf(objfmt_dbg->dbgfile, "(new) "); yasm_symtab_define_label(object->symtab, vp->val, diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c index 5ec17b7c..66fb6c56 100644 --- a/modules/objfmts/elf/elf-objfmt.c +++ b/modules/objfmts/elf/elf-objfmt.c @@ -945,7 +945,7 @@ elf_objfmt_add_default_section(yasm_object *object) int isnew; elf_secthead *esd; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); esd = elf_objfmt_init_new_section(object, retval, ".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0); yasm_section_set_default(retval, 1); @@ -1118,7 +1118,7 @@ elf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, } } - retval = yasm_object_get_general(object, sectname, 0, align, + retval = yasm_object_get_general(object, sectname, align, (data.flags & SHF_EXECINSTR) != 0, resonly, &isnew, line); diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c index 3f13948f..893ef0db 100644 --- a/modules/objfmts/macho/macho-objfmt.c +++ b/modules/objfmts/macho/macho-objfmt.c @@ -1272,8 +1272,8 @@ macho_objfmt_add_default_section(yasm_object *object) macho_section_data *msd; int isnew; - retval = yasm_object_get_general(object, "LC_SEGMENT.__TEXT.__text", 0, 0, 1, 0, - &isnew, 0); + retval = yasm_object_get_general(object, "LC_SEGMENT.__TEXT.__text", 0, 1, + 0, &isnew, 0); if (isnew) { msd = macho_objfmt_init_new_section(object, retval, ".text", 0); msd->segname = yasm__xstrdup("__TEXT"); @@ -1464,7 +1464,7 @@ macho_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, realname = yasm_xmalloc(strlen("LC_SEGMENT") + 1 + strlen(data.f_segname) + 1 + strlen(f_sectname) + 1); sprintf(realname, "LC_SEGMENT.%s.%s", data.f_segname, f_sectname); - retval = yasm_object_get_general(object, realname, 0, align, 1, resonly, + retval = yasm_object_get_general(object, realname, align, 1, resonly, &isnew, line); yasm_xfree(realname); diff --git a/modules/objfmts/rdf/rdf-objfmt.c b/modules/objfmts/rdf/rdf-objfmt.c index 2b96bed3..46a5a8c8 100644 --- a/modules/objfmts/rdf/rdf-objfmt.c +++ b/modules/objfmts/rdf/rdf-objfmt.c @@ -839,7 +839,7 @@ rdf_objfmt_add_default_section(yasm_object *object) rdf_section_data *rsd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 0, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); if (isnew) { rsd = rdf_objfmt_init_new_section(object, retval, ".text", 0); rsd->type = RDF_SECT_CODE; @@ -946,7 +946,7 @@ rdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, yasm_intnum_destroy(data.reserved_intn); } - retval = yasm_object_get_general(object, sectname, 0, 0, 1, + retval = yasm_object_get_general(object, sectname, 0, 1, data.type == RDF_SECT_BSS, &isnew, line); if (isnew) diff --git a/modules/objfmts/xdf/xdf-objfmt.c b/modules/objfmts/xdf/xdf-objfmt.c index 4ce2f3ef..a68dc0bf 100644 --- a/modules/objfmts/xdf/xdf-objfmt.c +++ b/modules/objfmts/xdf/xdf-objfmt.c @@ -634,7 +634,7 @@ xdf_objfmt_add_default_section(yasm_object *object) xdf_section_data *xsd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 0, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); if (isnew) { xsd = xdf_objfmt_init_new_section(object, retval, ".text", 0); yasm_section_set_default(retval, 1); @@ -745,7 +745,7 @@ xdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, } } - retval = yasm_object_get_general(object, sectname, 0, align, 1, resonly, + retval = yasm_object_get_general(object, sectname, align, 1, resonly, &isnew, line); if (isnew) -- 2.40.0