Subject: | |
From: | |
Reply To: | |
Date: | Wed, 14 Mar 2018 14:30:04 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
The only niggle is that, under the previous 7.4-x gcc-4.8.5-16
the switch in vclock_gettime.c compiled fine:
<quote><pre><code>
notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
{
int ret = VCLOCK_NONE;
switch (clock)
{
case CLOCK_REALTIME:
ret = do_realtime(ts);
break;
case CLOCK_MONOTONIC:
ret = do_monotonic(ts);
break;
case CLOCK_REALTIME_COARSE:
return do_realtime_coarse(ts);
case CLOCK_MONOTONIC_COARSE:
return do_monotonic_coarse(ts);
case CLOCK_MONOTONIC_RAW:
/* if I put ANYTHING here that references
&VVAR(vsyscall_gtod_data),
* or a call to an (inline) function that references
it, the build fails
* because a RELOCATION references the undefined symbol
* '__x86_indirect_thunk_rax' , when compiled with new
* GCC 4.8.5-16 20150623 , which the previous compiler,
* fully up-to-date as of 2018-03-13 when I updated to 20150623 ,
* compiled without any problems.
* So this would be enough to produce the unresolved relocation:
{ vsyscall_gtod_data *gt __attribute__((unused)) = gtod;
} break;
default:
break;
}
}
if (ret == VCLOCK_NONE)
return vdso_fallback_gettime(clock, ts);
return 0;
}
</code></pre></code>
ONLY reducing the number of clauses in the switch from 5 to 4 actually
fixed the problem - it was nothing to do with the details of any
function being called, it is something to do with accessing the
gtod pointer in a switch with more that 4 clauses.
So it now reads:
<quote><pre><code>
notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
{
int ret = VCLOCK_NONE;
switch (clock)
{case CLOCK_MONOTONIC_RAW:
ret = do_monotonic_raw(ts);
break;
default:
/* overcome gcc-4.8.5-16.el7_4.2.x86_64 BUG:
* if this switch contains more than 4 cases:
* a reference to `__x86_indirect_thunk_rax'
* is inserted, and final link fails with
* `relocation R_X86_64_PC32 against undefined symbol'.
*/
switch (clock) {
case CLOCK_REALTIME:
ret = do_realtime(ts);
break;
case CLOCK_MONOTONIC:
ret = do_monotonic(ts);
break;
case CLOCK_REALTIME_COARSE:
return do_realtime_coarse(ts);
case CLOCK_MONOTONIC_COARSE:
return do_monotonic_coarse(ts);
default:
break;
}
}
if (ret == VCLOCK_NONE)
return vdso_fallback_gettime(clock, ts);
return 0;
}
</code></pre></quote>
Now this is regardless of compilation with / without -fPIC .
I would appreciate any advice as to what is going on with
gcc-4.8.5-16 (20150623) + binutils as 2.25.1-32.base.el7_4.2 here
that is causing references to __x86_indirect_thunk_rax to be
inserted in the above switch with more than 4 clauses whenever
'gtod' is referenced . The patch I sent avoids the problem, but
why does the problem arise with the new GCC version and
not the old one ?
Thanks & Regards,
Jason
|
|
|