Issue 211004.1: Replace DW_MACRO_define/undef_sup with sized versions

Author: Paul Robinson
Champion: Jeremy Morse
Date submitted: 2021-10-04
Date revised:
Date closed: 2022-10-31
Type: Enhancement
Status: Accepted with modifications
DWARF Version: 6
Section various, pg various

As for DW_FORM_ref_sup[4,8], and issue 181026.2 which proposes a similar
pair of forms to replace DW_FORM_strp_sup, the macro definition opcodes
should allow distinguishing between 4-byte and 8-byte offsets within a
supplementary object file, and not assume the supplementary file and all
referencing files use the same 32/64 format.

Proposed changes to the specification:

Section 6.3.1 Macro Information Header

On p.166, lines 11-13, in the description of the `offset_size_flag 
add a sentence saying:
  This flag does not apply to the opcodes DW_MACRO_define_sup4,
  DW_MACRO_define_sup8, DW_MACRO_undef_sup4, and DW_MACRO_define_sup8.

Section Define and Undefine Entries

On p.168, lines 17-23, replace item 4 (DW_MACRO_define_sup`, DW_MACRO_undef_sup)
with the following (making the offset size dependent on the opcode
rather than the `offset_size_flag field):

4. DW_MACRO_define_sup4, DW_MACRO_define_sup8, DW_MACRO_undef_sup4,
    A DW_MACRO_define_sup4, DW_MACRO_define_sup8, DW_MACRO_undef_sup4,
    or DW_MACRO_undef_sup8 entry has two operands.  The first operand
    encodes the line number of the #define` or `#undef macro directive.
    The second operand identifies a string; it is represented as an 
    4-byte (DW_MACRO_define_sup4, DW_MACRO_undef_sup4) or 8-byte
    (DW_MACRO_define_sup8, DW_MACRO_undef_sup8) offset into the 
    .debug_str` section of the supplementary object file.

Section Macro Define String

On p.168 line 28, replace "DW_MACRO_define_sup" with "DW_MACRO_define_sup4
or DW_MACRO_define_sup8".

Section Macro Undefine String

On p.168 line 8, replace "DW_MACRO_undef_sup" with "DW_MACRO_undef_sup4
or DW_MACRO_undef_sup8".

Section Importation of Macro Units

On p.170, lines 24-29, replace the title and first paragraph of item 2
(DW_MACRO_import_sup) with the following:

2. DW_MACRO_import_sup4, DW_MACRO_import_sup8
    A DW_MACRO_import_sup4 or DW_MACRO_import_sup8 entry has one operand,
    a 4-byte (DW_MACRO_import_sup4) or 8-byte (DW_MACRO_import_sup8) offset
    from the start of the `.debug_macro` section in the supplementary object
    file.  Apart from the different location in which to find the macro 
    unit, these entry types are equivalent to DW_MACRO_import.

Section 7.3.6 DWARF Supplementary Object Files

On p.195, lines 28, replace "DW_MACRO_define_sup or DW_MACRO_undef_sup"
with "DW_MACRO_define_sup4, DW_MACRO_define_sup8, DW_MACRO_undef_sup4
or DW_MACRO_undef_sup8".

On p.195, line 30, replace "DW_MACRO_import_sup" with "DW_MACRO_import_sup4
or DW_MACRO_import_sup8".

Issue 181026.2 adds a non-normative paragraph to this section; probably it
should go at the end of the entire section, as it applies to both the forms
and macro directives.

2022-10-31:  Accepted with modifications:
   Add DW_MACRO_import_sup{4,8} in 6.3.1.
   Change the second mention of DW_MACRO_define_sup8 to DW_MACRO_undef_sup8.