Bug #2063

Position Independent Executables (PIE) create unwanted gmon files

Added by mroland almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:marino% Done:


Target version:-


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





#1 Updated by marino almost 3 years ago

I'll take it.

Also available in: Atom PDF