[Ada] Crash on aspect/pragma Linked_Section with -gnatR2
This patch modifies the output of the representation information related to
aspect or pragma Linker_Section, achieved with compiler switch -gnatR2. The
value of the section argument is now properly retrieved. Previously it was
assumed that the value is always a N_String_Literal, however the semantics
of the annotation allow for any static string expression, including a
reference to a static string.
------------
-- Source --
------------
-- linker_sections.ads
package Linker_Sections is
LS_1 : constant String := "1";
LS_2 : constant String := "2" & "2";
LS_3 : constant String := LS_1 & "3";
LS_4 : constant String := "4" & LS_2;
Val_1 : Integer with Linker_Section => LS_1;
Val_2 : Integer with Linker_Section => LS_2;
Val_3 : Integer with Linker_Section => LS_3;
Val_4 : Integer with Linker_Section => LS_4;
Val_5 : Integer with Linker_Section => LS_1 & "5";
Val_6 : Integer with Linker_Section => LS_2 & "6";
Val_7 : Integer with Linker_Section => LS_3 & "7";
Val_8 : Integer with Linker_Section => LS_4 & "8";
Val_9 : Integer with Linker_Section => "9" & LS_1;
Val_10 : Integer with Linker_Section => "10" & LS_2;
Val_11 : Integer with Linker_Section => "11" & LS_3;
Val_12 : Integer with Linker_Section => "12" & LS_4;
Val_13 : Integer; pragma Linker_Section (Val_13, LS_1);
Val_14 : Integer; pragma Linker_Section (Val_14, LS_2);
Val_15 : Integer; pragma Linker_Section (Val_15, LS_3);
Val_16 : Integer; pragma Linker_Section (Val_16, LS_4);
Val_17 : Integer; pragma Linker_Section (Val_17, LS_1 & "5");
Val_18 : Integer; pragma Linker_Section (Val_18, LS_2 & "6");
Val_19 : Integer; pragma Linker_Section (Val_19, LS_3 & "7");
Val_20 : Integer; pragma Linker_Section (Val_20, LS_4 & "8");
Val_21 : Integer; pragma Linker_Section (Val_21, "9" & LS_1);
Val_22 : Integer; pragma Linker_Section (Val_22, "10" & LS_2);
Val_23 : Integer; pragma Linker_Section (Val_23, "11" & LS_3);
Val_24 : Integer; pragma Linker_Section (Val_24, "12" & LS_4);
end Linker_Sections;
-----------------
-- Compilation --
-----------------
$ gcc -c -gnatR2s linker_sections.ads
2018-05-28 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* repinfo.adb (Expr_Value_S): New routine.
(List_Linker_Section): Properly extract the value of the section
argument.
From-SVN: r260825