Issue 230120.1: DW_OP_call_ref & DW_OP_implicit_pointer Correction

Author: Tony Tye
Champion: Tony Tye
Date submitted: 2023-01-20
Date revised: 2023-10-23
Date closed: 2023-10-16
Type: Error
Status: Accepted
DWARF Version: 6

Section 2.5.1.5, 2.6.1.1.4, pg 36, 41

BACKGROUND

In Section 2.5.1.5 (Control Flow Operations), the DW_OP_call_ref operator is described as being able to refer to DIEs in "an executable or shared object file other than that containing the operator." It goes on to say: "For references from one executable or shared object file to another, the relocation must be performed by the consumer."

In Section 7.5.5 (Classes and Forms) on page 217, which says "This type of reference (DW_FORM_ref_addr) is an offset from the beginning of the .debug_info section of the target executable or shared object file, or, for references within a supplementary object file, an offset from the beginning of the local .debug_info section; it is relocatable in a relocatable object file and frequently relocated in an executable or shared object file. For references from one shared object or static executable file to another, the relocation and identification of the target object must be performed by the consumer."

In neither case does DWARF provide any means to identify a reference from one linked object to another. For all practical purposes, DW_OP_call_ref and DW_FORM_ref_addr can only be used to refer to an offset within the same executable or shared object. Their purpose is for references between compilation units, not between linked objects.

The same applies to Section 2.6.1.1.4 (Implicit Location Descriptions) for the DW_OP_implicit_pointer operator.

PROPOSED CHANGES

In Section 2.5.1.5 (Control Flow Operations), on page 36, in item 4 (DW_OP_call2, etc.), replace the sentences:

"The operand is used as the offset of a debugging information entry in a .debug_info section which may be contained in an executable or shared object file other than that containing the operator. For references from one executable or shared object file to another, the relocation must be performed by the consumer."

with:

"The operand is used as the offset of a debugging information entry in the .debug_info section of the current executable or shared object file."

In Section 2.6.1.1.4 (Implicit Location Descriptions), on page 41, in item 3 (DW_OP_implicit_pointer), replace the sentence:

"The first operand is a 4-byte unsigned value in the 32-bit DWARF format, or an 8-byte unsigned value in the 64-bit DWARF format (see Section 7.4 on page 196)."

with:

"The first operand is a 4-byte unsigned value in the 32-bit DWARF format, or an 8-byte unsigned value in the 64-bit DWARF format (see Section 7.4 on page 196) that is used as the offset of a debugging information entry in the .debug_info section of the current executable or shared object file."

Delete the following paragraph that starts with "The first operand is used as the offset...".

In Section 7.5.5 (Classes and Forms), on page 217, in the second bullet item under "reference" ("The second type of reference..."), remove the sentence "For references from one shared object or static executable file to another, the relocation and identification of the target object must be performed by the consumer."


2023-10-16: Accepted.