[Bug libc/24640] New: __ppc_get_timebase_freq() always return 0 when using static linked glibc

raoni at linux dot ibm.com sourceware-bugzilla@sourceware.org
Wed Jun 5 20:24:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=24640

            Bug ID: 24640
           Summary: __ppc_get_timebase_freq() always return 0 when using
                    static linked glibc
           Product: glibc
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: raoni at linux dot ibm.com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Observed behavior:

__ppc_get_timebase_freq() always return 0.


Expected behavior:

__ppc_get_timebase_freq() return the same value of timebase in /proc/cpuinfo


Condition:

This is a powerpc specific bug (all variants) and only happens when linking
against static version of glibc.


Steps to reproduce:

this is a minimal example.c:
/******************************/
#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


Detailed description:

The underline code of __ppc_get_timebase_freq (__get_timebase_freq) has a
different implementation for shared and static version os glibc.  In the static
version there is wrong sense in an if check when opening /proc/cpuinfo.

Obs: I am already working on a fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list