ada: Use Code_Address attribute to determine subprogram addresses
commite256e67a8a3ce9adceca223a0974fc7dfdac1be5
authorPatrick Bernardi <bernardi@adacore.com>
Thu, 6 Apr 2023 20:55:01 +0000 (6 16:55 -0400)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:22 +0000 (29 10:23 +0200)
tree1b6152f12a01b00e3047f68e55b96b01bc590e8a
parentfe8b341f09a13e1dcaa2788f123d69122c5cdea5
ada: Use Code_Address attribute to determine subprogram addresses

The runtime used label addresses to determine the code address of
subprograms because the subprogram's canonical address on some targets
is a descriptor or a stub. Simplify the code by using the Code_Address
attribute instead, which is designed to return the code address of a
subprogram. This also works around a current GNAT-LLVM limitation where
the address of a label is incorrectly calculated when using -O1. As a
result, we can now build a-except.adb and g-debpoo.adb at -O1 again with
GNAT-LLVM.

gcc/ada/

* libgnat/a-excach.adb (Call_Chain): Replace
Code_Address_For_AAA/ZZZ functions with AAA/ZZZ'Code_Address.
* libgnat/a-except.adb (Code_Address_For_AAA/ZZZ): Delete.
(AAA/ZZZ): New null procedures.
* libgnat/g-debpoo.adb
(Code_Address_For_Allocate_End): Delete.
(Code_Address_For_Deallocate_End): Delete.
(Code_Address_For_Dereference_End): Delete.
(Allocate): Remove label and use Code_Address attribute to
determine subprogram addresses.
(Dellocate): Likewise.
(Dereference): Likewise.
(Allocate_End): Convert to null procedure.
(Dellocate_End): Likewise.
(Dereference_End): Likewise.
gcc/ada/libgnat/a-excach.adb
gcc/ada/libgnat/a-except.adb
gcc/ada/libgnat/g-debpoo.adb