Havard Eidnes | 28 Jul 11:42 2008
Picon

mcount.c / profile.h and fatal assembler warnings

Hi,

as should be well-known by now, the compilation of mcount.c now
fails on all our mips ports.  The reason this has recently
started happning is that assembler warnings have were recently
made fatal errors, through a change to <bsd.sys.mk>.  The warning
emitted is:

/var/tmp//ccXs67rq.s: Assembler messages:
/var/tmp//ccXs67rq.s:9: Warning: No .cprestore pseudo-op used in PIC code
/var/tmp//ccXs67rq.s:219: Error: 1 warnings, treating warnings as errors
--- mcount.o ---

This traces back to the assembly code in the MCOUNT macro in
sys/arch/mips/include/profile.h, which defines the _mcount symbol
and which calls the __mcount function, which is implemented in C,
and which is in common/lib/libc/gmon/mcount.c.

Now, if one were to just blindly follow the warnings from the
assembler, one would quickly discover that once you insert
".cprestore 24" into the assembly code, it next complains there
is no ".frame", and then that there is no ".ent", and lastly that
there is no ".end".

I have "fixed" all those things in my local source tree, but
since I'm no MIPS assembly expert, I suspect that _mcount() is no
longer working as it should, as it is now more or less a full-
fledged function, and I think the point of the assembly code is
to *not* be a full-fledged function.

(Continue reading)

Luke Mewburn | 29 Jul 16:26 2008
Picon

Re: mcount.c / profile.h and fatal assembler warnings

On Mon, Jul 28, 2008 at 11:42:34AM +0200, Havard Eidnes wrote:
  | as should be well-known by now, the compilation of mcount.c now
  | fails on all our mips ports.  The reason this has recently
  | started happning is that assembler warnings have were recently
  | made fatal errors, through a change to <bsd.sys.mk>.  The warning
  | emitted is:
  | 
  | /var/tmp//ccXs67rq.s: Assembler messages:
  | /var/tmp//ccXs67rq.s:9: Warning: No .cprestore pseudo-op used in PIC code
  | /var/tmp//ccXs67rq.s:219: Error: 1 warnings, treating warnings as errors
  | --- mcount.o ---

I discussed your proposal with Simon, and he wasn't 100% sure that
your suggested fix is correct.

I've committed a workaround to gmon/Makefile.inc to disable assembler
warnings for mcount.c on mips.

Once a fix is available that the MIPS gurus are happy with,
we can remove the workaround.

I apologise for taking so long to getting to this workaround,
and appreciate your effort in trying to fix it despite my slackness.

cheers,
Luke.

  | 
  | This traces back to the assembly code in the MCOUNT macro in
  | sys/arch/mips/include/profile.h, which defines the _mcount symbol
(Continue reading)

Havard Eidnes | 30 Jul 19:10 2008
Picon

Re: mcount.c / profile.h and fatal assembler warnings

> I discussed your proposal with Simon, and he wasn't 100% sure that
> your suggested fix is correct.

I'm pretty sure it isn't :-) Probably at least something related
to the link register isn't right.  However, it served it's
purpose, which was to get the build bug fixed.

> I've committed a workaround to gmon/Makefile.inc to disable
> assembler warnings for mcount.c on mips.

Thanks!

Regards,

- Håvard


Gmane