Project

General

Profile

Bug #5632

libm's use of _sse_hw is wrong and unnecessary (in that order)

Added by Rich Lowe almost 6 years ago. Updated almost 6 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

libm looks at the _sse_hw symbol provided by libc to tell whether it is running on an i386 system capable of SSE.

Unfortunately, it's defined thusly

int _sse_hw = 0;
#pragma weak _sse_hw

Notice how _sse_hw isn't extern, and that it has a value. This is going to screw up the logic later (which checks whether it's been bound), and generally it makes things really confused.

This is wrong.

It's weak because libm used to get shipped by devpro onto multiple releases (in its guise as libsunmath, or libmopt), and not all those releases wouldn't have that symbol in libc.

This is unnecessary.

It should just be a regular external reference to a private symbol, not weak, not defined, just extern.

#1

Updated by Electric Monk almost 6 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100

git commit f665a76fbe5ccb01d21f7917a7d764c98ed42344

commit  f665a76fbe5ccb01d21f7917a7d764c98ed42344
Author: Richard Lowe <richlowe@richlowe.net>
Date:   2015-02-26T19:19:36.000Z

    5632 libm's use of _sse_hw is wrong and unnecessary (in that order)
    Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Gordon Ross <gwr@nexenta.com>

Also available in: Atom PDF