[issue2063] Position Independent Executables (PIE) create unwanted gmon files

Michael Roland (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Thu May 5 08:42:52 PDT 2011

New submission from Michael Roland <csg at ocmulgeeemc.com>:

Using DragonFly BSD 2.10.1 Release, PIE programs like Samba35 and cups create
gmon profiling files. For example, the samba net command creates a file called
net.gmon. After a while, the file system is littered with these gmon files. They
cause no harm, but are not wanted.

The file src/lib/csu/i386/Makefile.csu has the profiling flag -DGCRT on the
Scrt1_c.o line. The -DGCRT flag should not be present on this line.

24 Scrt1_c.o:      crt1_c.c
25         ${CC} ${CFLAGS} -DGCRT -fPIC -DPIC -c -o Scrt1_c.o ${CSUDIR}/crt1_c.c

The fix is to remove the -DGCRT flag.

24 Scrt1_c.o:      crt1_c.c
25         ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1_c.o ${CSUDIR}/crt1_c.c

Makefile.csu was imported from FreeBSD. This is the description of the problem
from FreeBSD:

	MFC r205398: Do not create *.gmon files for PIE executables on i386.

Scrt1_c.o was accidentally compiled with -DGCRT (profiling), like gcrt1_c.o.
This problem is i386-specific, the other architectures are OK.

If you have problems with PIE executables such as samba and cups leaving
behind gmon files, rebuild them after installing this change.

PR:		ports/143924




messages: 9880
nosy: mroland
priority: bug
status: unread
title: Position Independent Executables (PIE) create unwanted gmon files

DragonFly issue tracker <bugs at lists.dragonflybsd.org>

More information about the Bugs mailing list