|
From: Philippe W. <phi...@sk...> - 2019-08-19 22:38:28
|
On Mon, 2019-08-19 at 23:31 +0200, Philippe Waroquiers wrote: > Note that it just took me now about 1 minute and 5 lines of code to reproduce it > in Ada (but I guess it can be done in whatever language: it is enough to just > produce a very large BSS). > > So, valgrind error message is correctly pointing at the problem of very large bss > (as was already determined in 2017 IIUC). > > Philippe > > Reproducer: package P is S : constant String (1 .. 1_800_000_000) := (others => 'a'); end P; with P; wit h Text_Io; use Text_Io; procedure Pm is begin Put_Line (P.S (1..10) & P.S(100..110)); end; A solution is to link the user executable at an address 'high enough' above the valgrind address: gnatmake -g pm ... valgrind ./pm valgrind: mmap(0x10e000, 1800007680) failed in UME with error 22 (Invalid argument). valgrind: this can be caused by executables with very large text, data or bss segments. rm ./pm gnatmake -g pm -largs -Wl,-Ttext-segment=0x68000000 ... valgrind ./pm ... ==19326== Warning: set address range perms: large range [0x68006000, 0xd34a5000) (defined) aaaaaaaaaaaaaaaaaaaaa ==19326== ==19326== HEAP SUMMARY: .... (valgrind itself is loaded at 0x58000000). We might maybe improve the valgrind mmap error detection and error message to indicate this solution. Philippe |