[PATCH] D28857: [ELF] - Allow relative relocations to a absolute value defined in linker script.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 06:45:45 PST 2017

>That is a bug in bfd. Its handling of what is absolute is broken. On ELF
>absolute really means absolute, like a size. Anything that is a position
>in the file is not absolute.

This script (https://github.com/torvalds/linux/blob/d33d5a6c88fcd53fec329a1521010f1bc55fa191/arch/x86/entry/vdso/vdso-layout.lds.S)
starts from:

  vvar_start = . - 2 * (1 << 12);
  vvar_page = vvar_start;
  vvar_vsyscall_gtod_data = vvar_page + 128;

I think vvar_start is always constant, do not know why they wrote ". - 2 * (1 << 12)" when it looks
could be just "- 2 * (1 << 12)".
At least I think original comment ("These variables live in a page of kernel data that has an extra RO* mapping for userspace. Each variable needs a unique offset within that page; specify that offset with the DECLARE_VVAR macro.")
saying that vvar_vsyscall_gtod_data value is a constant + offset == constant. So it not relative to position in file and behaves as absolute.

How do you think we should fix that ?


More information about the llvm-commits mailing list