Project

General

Profile

Actions

Bug #13341

closed

crt1.o _start_crt_compiler hook not what gcc expects

Added by Andy Fiddaman over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

As can be seen in https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/sol2/crtpg.c#L34 - gcc uses a hook in crt1.o in order to initialise profiling.
However, the hook in the illumos crt1.o is called _start_crt_compiler instead of __start_crt_compiler (one fewer underscore).

Building a program with profiling does not produce the expected gmon.out file:

r151036% gcc -pg -o c c.c
r151036% nm c | grep _mc
[93]    |             4200656|                   0|FUNC |GLOB |0    |14     |_mcleanup
[105]   |             4201092|                   0|FUNC |GLOB |0    |14     |_mcount
[62]    |             4201184|                   0|FUNC |LOCL |0    |14     |internal_mcount

r151036% truss ./c 2>&1 | grep gmon.out
r151036%

With an updated crt1.o that has the same symbol with a double underscore:

bloody% truss ./c 2>&1 | grep gmon.out
open("gmon.out", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3

Related issues

Related to illumos gate - Bug #8609: want a position independent CRTClosedRich Lowe2017-09-04

Actions
Actions

Also available in: Atom PDF