[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794222: on ppc64le, profiling with gcc -pg does not work, suspected bug in __gmon_start__



Package: libc6
Version: 2.19-18
Severity: normal
Tags: upstream

Dear Maintainer,

On a ppc64le host, programs compiled with -pg fail to record profiling
information at run-time.  At start-up time, the compiled program prints

monstartup: out of memory

and does not produce a gmon.out file.  A complete repro case is included
below.

I believe the problem is in the Glibc 2.19 sources, file
sysdeps/powerpc/powerpc64/entry.h.  The definition of TEXT_START is
appropriate for ppc64, i.e. version 1 of the ELF PPC64 ABI, where
function pointers have one level of indirection before reaching the
function code.  Version 2 of the ELF PPC64 ABI, as used in ppc64le, does
not have this indirection.  Hence the address of the _start symbol
should not be dereferenced.

Repro:

$ cat tst.c
int main() { return 0; }
$ gcc -pg tst.c
$ ./a.out
monstartup: out of memory
$ gdb a.out
[...]
(gdb) b __monstartup
Breakpoint 1 at 0x100008d4
(gdb) run
[...]
Breakpoint 1, 0x00003fffb7ed2d78 in __monstartup (lowpc=4053955894390558722,
    highpc=268437728) at gmon.c:104

Note the obviously wrong value of the lowpc parameter passed to
__monstartup by __gmon_start__

-- System Information:
Debian Release: 8.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: ppc64el (ppc64le)

Kernel: Linux 3.16.0-4-powerpc64le (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=locale: Cannot
set LC_ALL to default locale: No such file or directory
UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libc6 depends on:
ii  libgcc1  1:4.9.2-10

libc6 recommends no packages.

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]  1.5.56
pn  glibc-doc              <none>
ii  locales                2.19-18

-- debconf information:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "fr_FR.UTF-8",
	LC_MONETARY = "fr_FR.UTF-8",
	LC_ADDRESS = "fr_FR.UTF-8",
	LC_TELEPHONE = "fr_FR.UTF-8",
	LC_NAME = "fr_FR.UTF-8",
	LC_MEASUREMENT = "fr_FR.UTF-8",
	LC_IDENTIFICATION = "fr_FR.UTF-8",
	LC_NUMERIC = "fr_FR.UTF-8",
	LC_PAPER = "fr_FR.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
  glibc/restart-services:
  glibc/upgrade: true
  glibc/restart-failed:
  libraries/restart-without-asking: false
  glibc/disable-screensaver:


Reply to: