diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2018-06-14 17:04:32 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2018-06-14 17:04:32 -0700 |
commit | 29695c85fbf1f343b02c49502482727294645728 (patch) | |
tree | dd1d0cd631616cc45db1a55defb1b96b699abfb6 /output | |
parent | 13587802fe602556abe5c00b7a236bfbdd98a337 (diff) | |
download | nasm-29695c85fbf1f343b02c49502482727294645728.tar.gz |
labels: add a subsection field available for backend use
Allow the subsection to store a subsection value directly in the
label, rather than having to do strange encoding hacks.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'output')
-rw-r--r-- | output/outdbg.c | 14 | ||||
-rw-r--r-- | output/outmacho.c | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/output/outdbg.c b/output/outdbg.c index 4d41d4db..84cccf73 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -136,15 +136,17 @@ static int32_t dbg_section_names(char *name, int pass, int *bits) } static int32_t dbg_herelabel(const char *name, enum label_type type, - int32_t seg) + int32_t oldseg, int32_t *subsection) { - int32_t newseg = seg; - - if (subsections_via_symbols && type != LBL_LOCAL) - newseg += 0x10000; + int32_t newseg = oldseg; + if (subsections_via_symbols && type != LBL_LOCAL) { + newseg = *subsection; + if (newseg == NO_SEG) + newseg = *subsection = seg_alloc(); + } fprintf(ofile, "herelabel %s type %d (seg %08x) -> %08x\n", - name, type, seg, newseg); + name, type, oldseg, newseg); return newseg; } diff --git a/output/outmacho.c b/output/outmacho.c index ed1366b3..e4aa8000 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1003,10 +1003,11 @@ static int32_t macho_section(char *name, int pass, int *bits) } static int32_t macho_herelabel(const char *name, enum label_type type, - int32_t section) + int32_t section, int32_t *subsection) { struct section *s; (void)name; + (void)subsection; if (!(head_flags & MH_SUBSECTIONS_VIA_SYMBOLS)) return section; @@ -1014,7 +1015,7 @@ static int32_t macho_herelabel(const char *name, enum label_type type, /* No subsection only for local labels */ if (type == LBL_LOCAL) return section; - + s = get_section_by_index(section); if (!s) return section; |