[PATCH] LoongArch: Use copy relocation for %pc_lo12 against external symbol
Xi Ruoyao
xry111@xry111.site
Thu Sep 1 01:41:17 GMT 2022
On Thu, 2022-09-01 at 09:27 +0800, liuzhensong wrote:
> The R_LARCH_COPY is supported in older versions, we removed this
> feature and are not going to support.
Hmm, then for
extern int x;
int f() { return x; }
it will produce a GOT access. If x is in another TU but not in a shared
library, such a GOT access and the GOT entry is unneeded.
This will be really a pain for situations like building an OS kernel, or
with -static or -static-pie. Even for this simple example, there is no
way to tell "x" is not in a shared library (maybe, expect LTO or linker
relaxation, but IIRC LTO or relaxation do not *guarantee* to avoid the
GOT, just "try to" avoid the GOT).
So is there any serious reason forbidding us from using R_LARCH_COPY? Or
any options for this "unneeded GOT" issue?
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Binutils
mailing list