For x86-64 psABI, the entry size of .got and .got.plt sections is 8
bytes for both LP64 and ILP32. Add GotEntrySize and GotPltEntrySize
to ELF target instead of using size of ELFT::uint. Now we can generate
a simple working x32 executable:
[hjl@gnu-skl-1 pr28507]$ gcc -mx32 -B./ -o foo foo.o -Wl,-v
collect2 version 6.1.1 20160621 (Red Hat 6.1.1-3)
./ld -plugin /usr/libexec/gcc/x86_64-redhat-linux/6.1.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/6.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccSNGyqu.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf32_x86_64 -dynamic-linker /libx32/ld-linux-x32.so.2 -o foo /usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../libx32/crt1.o /usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../libx32/crti.o /usr/lib/gcc/x86_64-redhat-linux/6.1.1/x32/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/6.1.1/x32 -L/usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../libx32 -L/lib/../libx32 -L/usr/lib/../libx32 -L. -L/usr/lib/gcc/x86_64-redhat-linux/6.1.1 -L/usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../.. foo.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/6.1.1/x32/crtend.o /usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../libx32/crtn.o
LLD 3.9 (ssh://llvm@gnu-4.sc.intel.com/export/server/git/llvm/lld 96b35f25c4f2253e9be5b814913106ec072a84d9)
[hjl@gnu-skl-1 pr28507]$ ./foo
hello
[hjl@gnu-skl-1 pr28507]$
Sort.