Issue 260428.1: Accessibility Declarations for FreePascal

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

Comparing original with latest. [ Return to the latest version ]

# Accessibility Declarations for FreePascal

## Issue

DWARF5 only has Accessibility declarations `DW_ACCESS_public`,
`DW_ACCESS_private`, and `DW_ACCESS_protected`. However, FreePascal has a
couple more that need to be represented. This is needed so that
debuggers can report it back to users and so that ABI checkers like
libabigail can detect changes to the API which would then change the ABI
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
debuggers to report member accessibility accurately to users and
enables ABI checkers like libabigail to detect API changes that affect
of an object.
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.

### 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. 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 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.*
> *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 three more accessibility codes
and add second column with their meanings:
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_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_module_private`    | The declaration can only be accessed in the module that contains the declaration. |
> | `DW_ACCESS_module_protected`  | The declaration can only be accessed in the module that contains the declaration. |
> | `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_published`         | Similar in access policy to public with additonal RTTI information preserved for visual programming. |

Then later on in Chapter 2 possibly between 2.9 Virtuality of
Declarations and 2.10 Artificial Entries add a new Section:

> 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 in Table 8.14 Add the following entries to table 8.14:
In Section 8.9 Add the following entries to table 8.14:

> | Accessibility code name       | Value |
> | ----------------------------- | ----- |
> | `DW_ACCESS_module_private`    | TBD   |
> | `DW_ACCESS_module_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`.