ARC: ldso: don't use _DYNAMIC@gotpc construct #2
commit2db45cff132e9b3c84700a4a2401dd8a06c2cf22
authorVineet Gupta <Vineet.Gupta1@synopsys.com>
Fri, 13 Jan 2017 20:24:53 +0000 (13 12:24 -0800)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Sun, 15 Jan 2017 18:21:24 +0000 (15 19:21 +0100)
treeba773dde5bad2615e80088172ad98d65a6466b9b
parentd36553c70fd1e64277fdb8c09efd915b706131af
ARC: ldso: don't use _DYNAMIC@gotpc construct #2

This removes _DYNAMIC@gotpc from elf_machine_load_address()
This is a seperate commit to callout the fact that old code was actually
broken but was NOT caught since it never gets called (and will never be)
since ld.so only calls it if kernel doesn't pass AT_BASE auxvt, which is
not true for Linux.

    if (!auxvt[AT_BASE].a_un.a_val)
auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();

So while the intent was to remove _DYNAMIC@gotpc construct, we need to
come up with something which works.

The build time address computation of .dynamic which works well is:

- "ld  %1, [pcl, _DYNAMIC@gotpc] \n"
+ "ld  %1, [pcl, _GLOBAL_OFFSET_TABLE_@pcl] \n"

However the runtime address of .dynamic can only be generated with

        "add %0, pcl, _DYNAMIC@pcl      \n"

which unfortunately is what is currently broken as it is converted to
i_GLOBAL_OFFSET_TABLE_t and thus refers to runtime address of .got and
not .dyanmic

Thus we resort to using an arbit symbol _dl_start at the expense of an
extra GOT entry and a bogus R_ARC_NONE relo in ldso itself which now
needs to be ignored.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
ldso/ldso/arc/dl-startup.h
ldso/ldso/arc/dl-sysdep.h