x86, kaslr: Handle Gold linker for finding bss/brk
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / tools / calc_run_size.pl
index 0b0b124..23210ba 100644 (file)
@@ -19,7 +19,16 @@ while (<>) {
                if ($file_offset == 0) {
                        $file_offset = $offset;
                } elsif ($file_offset != $offset) {
-                       die ".bss and .brk lack common file offset\n";
+                       # BFD linker shows the same file offset in ELF.
+                       # Gold linker shows them as consecutive.
+                       next if ($file_offset + $mem_size == $offset + $size);
+
+                       printf STDERR "file_offset: 0x%lx\n", $file_offset;
+                       printf STDERR "mem_size: 0x%lx\n", $mem_size;
+                       printf STDERR "offset: 0x%lx\n", $offset;
+                       printf STDERR "size: 0x%lx\n", $size;
+
+                       die ".bss and .brk are non-contiguous\n";
                }
        }
 }