2 * Copyright 2014 Andy Lutomirski
3 * Subject to the GNU Public License, v.2
5 * Hack to keep broken Go programs working.
7 * The Go runtime had a couple of bugs: it would read the section table to try
8 * to figure out how many dynamic symbols there were (it shouldn't have looked
9 * at the section table at all) and, if there were no SHT_SYNDYM section table
10 * entry, it would use an uninitialized value for the number of symbols. As a
11 * workaround, we supply a minimal section table. vdso2c will adjust the
12 * in-memory image so that "vdso_fake_sections" becomes the section table.
14 * The bug was introduced by:
15 * https://code.google.com/p/go/source/detail?r=56ea40aac72b (2012-08-31)
16 * and is being addressed in the Go runtime in this issue:
17 * https://code.google.com/p/go/issues/detail?id=8197
21 #error This hack is specific to the 64-bit vDSO
24 #include <linux/elf.h>
26 extern const __visible struct elf64_shdr vdso_fake_sections[];
27 const __visible struct elf64_shdr vdso_fake_sections[] = {
29 .sh_type = SHT_DYNSYM,
30 .sh_entsize = sizeof(Elf64_Sym),