Issue 260428.1: Accessibility Declarations for FreePascal

Author: Martin Friebe
Champion: Ben Woodard
Date submitted: 2026-04-28
Date revised: 2026-11-04
Date closed:
Type: Enhancement
Status: Open
DWARF version: 6

Comparing 2026-10-23 with latest. [ Return to the latest version ]

## Issue

DWARF Version 5 only has Accessibility declarations
`DW_ACCESS_public`, `DW_ACCESS_private`, and
`DW_ACCESS_protected`. However, Free Pascal defines additional
visibility specifiers that need representation. This addition allows
accessibility specifiers that need representation. This addition allows
debuggers to report member accessibility accurately to users and
enables ABI checkers like libabigail to detect API changes that affect
the ABI of an object.

The full list can be found in the [Free Pascal Reference Guide][ref].

[ref]: https://www.freepascal.org/docs-html/ref/refse35.html

In the documentation for Free Pascal, the terminology that they
currently use literally uses the word "visibility". This led to some
confusion and this topic was extensively researched. The conclusion
that we arrived at is that in the Pascal community it is customary to
use the word "visibility" in a way where it is synonymous with the
DWARF concept of accessibility.  This use should not be confused with
ELF symbol visibility or the DWARF concept of visibility. It is just
historical and customary in Pascal community to use "visibility" and
"accessibility" interchangeably.

### Strict vs module

It was debated whether to add `DW_ACCESS_module_private` and
`DW_ACCESS_module_protected` or `DW_ACCESS_strict_private` and
`DW_ACCESS_strict_protected`. The hope was that `DW_ACCESS_private`and
`DW_ACCESS_protected` could be used for FreePascal's "strict private"
and "strict protected" since the semantics more closely match those of
the existing access qualifiers which were based on C++'s
semantics. Then the FreePascal "private" and "protected" keywords
could be mapped to `DW_ACCESS_module_private` and
`DW_ACCESS_module_protected`. The problem with this approach was that
other implementations of Pascal already use `DW_ACCESS_private`and
`DW_ACCESS_protected` in a way that means "module private" and "module
protected". Changing this in DWARF6 would force a version check at the
translation unit level. Therefore, to maintain backward compatibility,
it was decided to simply add the strict versions of the access
qualifiers.

### Published

Free Pascal also has a concept of "published". This topic was also
researched extensively. The graphical GUI editor for the extension to
Pascal called Delphi that Free Pascal was derived from relied on Run
Time Type Information (RTTI) to associate graphical widgets with
classes that implemented their functionality. The Free Pascal compiler
uses the "published" keyword to instruct the compiler to include this
RTTI information with the class.
RTTI information with the class. It was determined that the concept is
not related to the DWARF concept of access.

Other compilers for languages including C++ also selectively include
RTTI information for classes. Therefore, it was decided to add a new
attribute `DW_AT_rtti` that Free Pascal can use in conjunction with
`DW_ACCESS_public` to indicate, that the class is "published". It
should be noted that even though C++ does selectively emit RTTI
information, there is no currently known demonstrated need for
`DW_AT_rtti` by C++ producers or consumers. Never the less, we believe
that `DW_AT_rtti` may prove to be more generally useful than
`DW_AT_published` which likely would only be used by Free Pascal.

## Proposal

In Section 2.2 in Table 2.2 add:

> | Attribute    | Usage |
> | ------------ | ----- |
> | `DW_AT_rtti` | Objects or types have Run Time Type Information |

In Section 2.7:

Add Pascal to the list of languages which have Accessibility of
Declarations so that it reads:

> *Some languages, notably C++, Ada, <ins>and some dialects of
> Pascal</ins>, have the concept of the accessibility of an object or of
> some other program entity. The accessibility specifies which classes
> of other program objects are permitted access to the object in
> question.*

Just before the table in Section 2.7 add this paragraph:

> The precise meaning and semantics of these codes must be interpreted
> in the context of the rules of source language where the declaration
> is made.

In Table 2.4 add two more accessibility codes and add second column
with their meaning:

> | Accessibility code name       | Meaning                              |
> | ----------------------------- | ------------------------------------ |
> | `DW_ACCESS_public`            | The declaration can be used anywhere without access restriction. |
> | `DW_ACCESS_private`           | The declaration can be used only by members and friends of the class in which it is declared. |
> | `DW_ACCESS_private`           | The declaration can be accessed only by the  members and friends of the class in which it is declared.\* |
> | `DW_ACCESS_protected`         | The declaration can be used only by members and friends of the class in which it is declared, by classes derived from that class, and by their friends. |
> | `DW_ACCESS_protected`         | The declaration can be accessed only members and friends of the class in by which it is declared, by classes derived from that class, and by their friends.\* |
> | `DW_ACCESS_module_private`    | The declaration can only be accessed in the module that contains the declaration. |
> | `DW_ACCESS_strict_private`    | The declaration can be accessed only by the  members and friends of the class in which it is declared.\* |
> | `DW_ACCESS_module_protected`  | The declaration can only be accessed within module that contains the declaration, or by the members and friends of the class in which it is declared, or by classes derived from that class, and by their friends. |
> | `DW_ACCESS_strict_protected`  | The declaration can be accessed only members and friends of the class in by which it is declared, by classes derived from that class, and by their friends.\* |
> | `DW_ACCESS_published`         | Similar in access policy to public with additonal RTTI information preserved for visual programming. |
> | `DW_ACCESS_published`         | The declaration can be used anywhere without access restriction and the compiler has included additional run time type information needed by GUI building tools. |

Then after the table, add the following footnote:
Then later on in Chapter 2 possibly between 2.9 Virtuality of
Declarations and 2.10 Artificial Entries add a new Section:

> *\*As an example of how these codes must be interpreted
> in the context of the rules of the source language, in some dialects
> of Pascal "private" and "protected" are understood to also allow
> unrestricted access within the module or translation unit, while
> "strict private" and "strict protected" have semantics closer to
> C++'s use of private and protected.*
> 2.N Run Time Type Information
>
> *Several languages (such as Free Pascal) need to indicate when an
> entity such as a class has Run Time Type Information (RTTI) available.*
>
> If a declaration includes instructions to the compiler that an
> entity such as a class has Run Time Type Information, then
> `DW_AT_rtti` may be used.

In section 8.5.4 Attribute Encodings Table 8.5 add:

> | Attribute Name | Value | Classes |
> | -------------- | ----- | ------- |
> | `DW_AT_rtti`   | TBD   | flag    |

In Section 8.9 Add the following entries to table 8.14:

> | Accessibility code name       | Value |
> | ----------------------------- | ----- |
> | `DW_ACCESS_module_private`    | TBD   |
> | `DW_ACCESS_strict_private`    | TBD   |
> | `DW_ACCESS_module_protected`  | TBD   |
> | `DW_ACCESS_strict_protected`  | TBD   |
> | `DW_ACCESS_published`         | TBD   |

---

2026-05-10: Added `DW_ACCESS_published` for completeness.

2026-09-24: Added Pascal to non-normative text listing languages
that have accessibility attributes.

2026-09-29: Removed `DW_ACCESS_strict_private/protected` and added
`DW_ACCESS_module_private/protected`;
Added basic semantics of different policies.

2026-10-23: [Revised][diff1]. Replaced "published" accessibility code
with a new `DW_AT_rtti` attribute.
Fixed incorrect description for `DW_ACCESS_module_protected`.

2026-11-04: [Revised][diff2]. Moved back to strict private and protected,
and added published back as an access qualifier.