/* User-provided starts */
/*@null@*/ /*@owned@*/ yasm_expr *start, *vstart;
+ /* User-provided segments */
+ /*@null@*/ /*@owned@*/ yasm_expr *vseg;
+
/* User-provided follows */
/*@null@*/ /*@owned@*/ char *follows, *vfollows;
/* Calculated (final) starts, used only during output() */
/*@null@*/ /*@owned@*/ yasm_intnum *istart, *ivstart;
+ /* Calculated (final) starts, used only during output() */
+ /*@null@*/ /*@owned@*/ yasm_intnum *ivseg;
+
/* Calculated (final) length, used only during output() */
/*@null@*/ /*@owned@*/ yasm_intnum *length;
} bin_section_data;
} else
bsd->ivstart = NULL;
+ /* Calculate section integer vseg. */
+ if (bsd->vseg) {
+ bsd->ivseg = yasm_expr_get_intnum(&bsd->vseg, 0);
+ if (!bsd->ivseg) {
+ yasm_error_set(YASM_ERROR_TOO_COMPLEX,
+ N_("vseg expression is too complex"));
+ yasm_errwarn_propagate(info->errwarns, bsd->vseg->line);
+ return 1;
+ } else
+ bsd->ivseg = yasm_intnum_copy(bsd->ivseg);
+ } else
+ bsd->ivseg = NULL;
+
/* Calculate section integer length. */
bsd->length = yasm_calc_bc_dist(yasm_section_bcs_first(sect),
yasm_section_bcs_last(sect));
typedef struct map_output_info {
/* address width */
int bytes;
+ int vseg_present;
/* intnum output static data areas */
unsigned char *buf;
info->bytes *= 2;
while (!yasm_intnum_check_size(bsd->ivstart, info->bytes * 8, 0, 0))
info->bytes *= 2;
+ if (bsd->ivseg) {
+ info->vseg_present = 1;
+ while (!yasm_intnum_check_size(bsd->ivseg, info->bytes * 8, 0, 0))
+ info->bytes *= 2;
+ }
return 0;
}
map_print_intnum(info->intn, info);
fprintf(info->f, " ");
+ if (info->vseg_present) {
+ if (bsd->ivseg == NULL) {
+ size_t i;
+ for (i = info->bytes; i != 0; i--)
+ fprintf(info->f, "--");
+ } else
+ map_print_intnum(bsd->ivseg, info);
+ fprintf(info->f, " ");
+ }
+
map_print_intnum(bsd->istart, info);
fprintf(info->f, " ");
bsd->follows ? bsd->follows : "not defined");
fprintf(info->f, "\nvstart: ");
map_print_intnum(bsd->ivstart, info);
+ fprintf(info->f, "\nvseg: ");
+ if (bsd->ivseg)
+ map_print_intnum(bsd->ivseg, info);
+ else
+ fprintf(info->f, "not defined");
fprintf(info->f, "\nvalign: ");
map_print_intnum(bsd->valign, info);
fprintf(info->f, "\nvfollows: %s\n\n",
* fields. Start with a minimum of 4.
*/
mapinfo.bytes = 4;
+ mapinfo.vseg_present = 0;
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);
fprintf(f, "-- Sections (summary) ");
for (i=0; i<57; i++)
fputc('-', f);
- fprintf(f, "\n\n%-*s%-*s%-*s%-*s%-*s%-*s%s\n",
+ fprintf(f, "\n\n%-*s%-*s%-*s%-*s%-*s%-*s%-*s%s\n",
mapinfo.bytes*2+2, "Vstart",
mapinfo.bytes*2+2, "Vstop",
+ mapinfo.vseg_present ? mapinfo.bytes*2+2 : 0,
+ mapinfo.vseg_present ? "Vseg" : "",
mapinfo.bytes*2+2, "Start",
mapinfo.bytes*2+2, "Stop",
mapinfo.bytes*2+2, "Length",
data->valign = NULL;
data->start = NULL;
data->vstart = NULL;
+ data->vseg = NULL;
data->follows = NULL;
data->vfollows = NULL;
data->istart = NULL;
/*@only@*/ /*@null@*/ char *vfollows;
/*@only@*/ /*@null@*/ yasm_expr *start;
/*@only@*/ /*@null@*/ yasm_expr *vstart;
+ /*@only@*/ /*@null@*/ yasm_expr *vseg;
/*@only@*/ /*@null@*/ yasm_intnum *align;
/*@only@*/ /*@null@*/ yasm_intnum *valign;
unsigned long bss;
offsetof(struct bin_section_switch_data, start), 0 },
{ "vstart", 1, yasm_dir_helper_expr,
offsetof(struct bin_section_switch_data, vstart), 0 },
+ { "vseg", 1, yasm_dir_helper_expr,
+ offsetof(struct bin_section_switch_data, vseg), 0 },
{ "align", 1, yasm_dir_helper_intn,
offsetof(struct bin_section_switch_data, align), 0 },
{ "valign", 1, yasm_dir_helper_intn,
data.vfollows = bsd->vfollows;
data.start = bsd->start;
data.vstart = bsd->vstart;
+ data.vseg = bsd->vseg;
data.align = NULL;
data.valign = NULL;
data.bss = bsd->bss;
data.vfollows = NULL;
data.start = NULL;
data.vstart = NULL;
+ data.vseg = NULL;
data.align = NULL;
data.valign = NULL;
data.bss = strcmp(sectname, ".bss") == 0;
bsd->valign = data.valign;
bsd->start = data.start;
bsd->vstart = data.vstart;
+ bsd->vseg = data.vseg;
bsd->follows = data.follows;
bsd->vfollows = data.vfollows;
yasm_expr_destroy(bsd->start);
if (bsd->vstart)
yasm_expr_destroy(bsd->vstart);
+ if (bsd->vseg)
+ yasm_expr_destroy(bsd->vseg);
if (bsd->follows)
yasm_xfree(bsd->follows);
if (bsd->vfollows)
yasm_expr_print(bsd->start, f);
fprintf(f, "\n%*svstart=", indent_level, "");
yasm_expr_print(bsd->vstart, f);
+ fprintf(f, "\n%*svseg=", indent_level, "");
+ yasm_expr_print(bsd->vseg, f);
fprintf(f, "\n%*sfollows=", indent_level, "");
if (bsd->follows)