+2018-04-04 Olivier Hainque <hainque@adacore.com>
+
+ * libgnat/s-objrea.ads (Get_Memory_Bounds): Rename as Get_Xcode_Bounds.
+ (Object_Section): Rename Flag_Alloc component as Flag_Xcode.
+ * libgnat/s-objrea.adb (Get_Xcode_Bounds): Adjust to new subprogram and
+ component name.
+ (Get_Section, ELF case): Set Flag_Xcode from SHF_EXECINSTR.
+ * libgnat/s-dwalin.adb (Open): Adjust to the Get_Memory_Bounds name
+ change.
+
2018-04-04 Olivier Hainque <hainque@adacore.com>
* libgnat/s-dwalin.ads (Dwarf_Context): Change type of Load_Address to
Success := True;
- -- Get memory bounds
+ -- Get memory bounds for executable code. Note that such code
+ -- might come from multiple sections.
- Get_Memory_Bounds (C.Obj.all, Lo, Hi);
+ Get_Xcode_Bounds (C.Obj.all, Lo, Hi);
C.Low := Storage_Offset (Lo);
C.High := Storage_Offset (Hi);
end record;
SHF_ALLOC : constant := 2;
+ SHF_EXECINSTR : constant := 4;
type Symtab_Entry32 is record
St_Name : uint32; -- Name (string table index)
Offset (SHdr.Sh_Offset),
uint64 (SHdr.Sh_Addr),
uint64 (SHdr.Sh_Size),
- (SHdr.Sh_Flags and SHF_ALLOC) /= 0);
+ (SHdr.Sh_Flags and SHF_EXECINSTR) /= 0);
end Get_Section;
------------------------
end if;
end Get_Section;
- -----------------------
- -- Get_Memory_Bounds --
- -----------------------
+ ----------------------
+ -- Get_Xcode_Bounds --
+ ----------------------
- procedure Get_Memory_Bounds
+ procedure Get_Xcode_Bounds
(Obj : in out Object_File;
Low, High : out uint64) is
Sec : Object_Section;
Low := uint64'Last;
High := uint64'First;
+ -- Now find the lowest and highest offsets
+ -- attached to executable code sections
for Idx in 1 .. Num_Sections (Obj) loop
Sec := Get_Section (Obj, Idx - 1);
- if Sec.Flag_Alloc then
+ if Sec.Flag_Xcode then
if Sec.Addr < Low then
Low := Sec.Addr;
end if;
end if;
end if;
end loop;
- end Get_Memory_Bounds;
+ end Get_Xcode_Bounds;
----------
-- Name --
Sec : Object_Section) return Mapped_Stream;
-- Create a stream for section Sec
- procedure Get_Memory_Bounds
+ procedure Get_Xcode_Bounds
(Obj : in out Object_File;
Low, High : out uint64);
-- Return the low and high addresses of the code for the object file. Can
Size : uint64 := 0;
-- Length of the section in bytes
- Flag_Alloc : Boolean := False;
- -- True if the section is mapped in memory by the OS loader
+ Flag_Xcode : Boolean := False;
+ -- True if the section is advertised to contain executable code
end record;
Null_Section : constant Object_Section := (0, 0, 0, 0, False);