diff options
author | Stan Shebs <stanshebs@google.com> | 2019-06-19 17:15:35 -0300 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> | 2019-06-19 19:11:06 -0300 |
commit | 335c1007bf183163c0a19724111a64097955b325 (patch) | |
tree | 232b87dbefb9d14ccdb7c0cadd35f97e7e7d64aa /libio/oldtmpfile.c | |
parent | f59a54ab0c2dcaf9ee946df2bfee9d4be81f09b8 (diff) | |
download | glibc-335c1007bf183163c0a19724111a64097955b325.tar.gz glibc-335c1007bf183163c0a19724111a64097955b325.tar.xz glibc-335c1007bf183163c0a19724111a64097955b325.zip |
powerpc: Fix static-linked version of __ppc_get_timebase_freq [BZ #24640]
__ppc_get_timebase_freq() always return 0 when using static linked glibc. This is a minimal example.c to reproduce: /******************************/ #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <sys/platform/ppc.h> int main() { uint64_t freq = __ppc_get_timebase_freq(); printf("Time Base frequency = %"PRIu64" Hz\n", freq); if (freq == 0) return -1; return 0; } /******************************/ Compile command: gcc -static example.c This bug has been reproduced, fixed and tested on all powerpc platforms (ppc32, ppc64 and ppc64le). The underlying code of __ppc_get_timebase_freq uses __get_timebase_freq that has a different implementation for shared and static version of glibc. In the static version, there is an incorrect sense in the if check for the fd returned when opening /proc/cpuinfo. This solution is mostly a cherry-pick from: commit 4791e4f773d060c1a37b27aac5b03cdfa9327afc Author: Stan Shebs <stanshebs@google.com> Date: Fri May 17 12:25:19 2019 -0700 Subject: Fix sense of a test in the static-linking version of ppc get_clockfreq That is in branch glibc/google/grte/v5-2.27/master and was mentioned for inclusion on master here: https://www.sourceware.org/ml/libc-alpha/2019-05/msg00409.html Adapted from original fix for get_clockfreq. That code was moved to get_timebase_freq. Also added a static-build testcase for __ppc_get_timebase_freq since the underlying function has different implementations for shared and static build. [BZ #24640] * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c [!SHARED] (__get_timebase_freq): Fix sense of a test in the static-linking version. * sysdeps/unix/sysv/linux/powerpc/Makefile (tests-static): Add test-gettimebasefreq-static. (tests): Likewise. * sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq-static.c: New file.
Diffstat (limited to 'libio/oldtmpfile.c')
0 files changed, 0 insertions, 0 deletions