Bug 979 - gcc doesn't always inline gnu_dev_makedev
Summary: gcc doesn't always inline gnu_dev_makedev
Status: RESOLVED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: libdrm (show other bugs)
Version: XOrg git
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Default DRI bug account
QA Contact:
URL: http://bugs.gentoo.org/show_bug.cgi?i...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-03 19:26 UTC by Adam Jackson
Modified: 2004-08-10 23:25 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
always use our definition of makedev() (655 bytes, patch)
2004-08-03 19:26 UTC, Adam Jackson
no flags Details | Splinter Review

Description Adam Jackson 2004-08-03 19:26:30 UTC
in xf86drm.c, we include <sys/sysmacros.h> to get the system definition of
makedev.  this turns out to be a bad move.  with some glibc versions, makedev()
is a macro, and with some it's an inline function.  since gcc's inline keyword
is merely a suggestion, occasionally we get the awkward situation where the call
to makedev() is emitted as a function call into glibc, which the elfloader is
apparently unable to handle correctly.

in the future the dlloader should handle this correctly.  in the meantime, the
attached patch should fix it.  one potential issue is that the full definition
of gnu_dev_makedev is more elaborate than our replacement; i doubt it ever
matters though.
Comment 1 Adam Jackson 2004-08-03 19:26:58 UTC
Created attachment 564 [details] [review]
always use our definition of makedev()
Comment 2 Allison Lortie (desrt) 2004-08-03 19:44:23 UTC
This patch doesn't seem like an entirely good idea.  It leads to redefinition of
makedev (not a huge problem, but enough to trigger a compiler warning)

I kept the original patch for this ultra-minimal just to show what the bug was
and offer a workaround for those affected.

Better options for a real fix:
- #undef makedev
- don't include <sys/sysmacros.h>
- call the macro something else and use it by its new name (to not conflict)
- don't use a macro at all (just merge the logic into the program)

One of the last two is probably best.
Comment 3 Adam Jackson 2004-08-11 16:25:15 UTC
right you are.  not including sysmacros.h does the right thing.

committed (to both Xorg and drm), thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.