Bug 1466

Summary: [PATCH] selectable with/without PIC to build libGL on i386 Linux
Product: xorg Reporter: ISHIKAWA Mutsumi <ishikawa>
Component: Server/Ext/GLXAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: high CC: ajax
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
URL: http://hanzubon.jp/patches/xorg/selectable_BuildLibGlxWithoutPIC.diff
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
patch to be selectable libGL with/without PIC flag on i386 Linux system
none
libglx-pic-overridable.patch none

Description ISHIKAWA Mutsumi 2004-09-25 00:58:03 UTC
on ix86 Linux, GLX force to build without PIC flag. 
 
--- xc/config/cf/linux.cf (line 365...) 
/* 
 * Build shared libGL and the DRI modules without -fPIC on some 
architectures. 
 * This improves performance. 
 */ 
#if BuildXF86DRI 
# if defined(i386Architecture) 
#  define BuildLibGlxWithoutPIC YES 
# endif 
#endif 
---- 
 
  So, if we wisth to build libGL with PIC on i386 Linux, we have to edit 
xc/config/cg/linux.cf directly.  I think better to be able to select with/without 
PIC. 
 
  For Debian package, Shared libraries must to be built with -fPIC 
option. It is describe in Debian policy #10.2. 
 
  http://www.debian.org/doc/debian-policy/ch-files.html#s-libraries
Comment 1 ISHIKAWA Mutsumi 2004-09-25 00:59:40 UTC
Created attachment 968 [details] [review]
patch to be selectable libGL with/without PIC flag on i386 Linux system
Comment 2 Adam Jackson 2004-09-25 15:19:27 UTC
Created attachment 970 [details] [review]
libglx-pic-overridable.patch

the first patch is broken.  BuildLibGlxWithoutPIC is always defined, so the
'#ifndef BuildLibGlxWithoutPIC' stanza never has any effect.  attached patch
does it better, and distros may force a BuildLibGlxWithoutPIC setting in
host.def.

i'd also make a note at this point that the Debian policy is broken:

"The shared version of a library must be compiled with -fPIC, and the static
version must not be."

this _will_ fail on amd64 when someone builds a DSO that links in code from a
static library.  on amd64 any object file that may find it's way into a DSO
must be compiled with -fPIC.  this is true of several other architectures, hppa
and (i think) ia64 at least.
Comment 3 ISHIKAWA Mutsumi 2004-09-25 23:32:59 UTC
(In reply to comment #2) 
 
> the first patch is broken.  BuildLibGlxWithoutPIC is always defined, so the 
> '#ifndef BuildLibGlxWithoutPIC' stanza never has any effect. 
 
 Hum? I don't understand why it is always defined. 
 
 1st chunk of my patch will define BuildLibGlxWithoutPIC for 
only Debian GNU/Linux system. 
 
#if LinuxDistribution == LinuxDebian 
(.....) 
# define BuildLibGlxWithoutPIC  NO 
(.....) 
#endif 
 
I believe this section has an effect only for Debian GNU/Linux. 
BuildLibGlxWithoutPIC is always defined for Debian GNU/Linux system only 
 
 
 
 
 
Comment 4 Adam Jackson 2004-09-26 00:27:38 UTC
d'oh, you're right, didn't read enough of the context.  that looks good then,
i'll go ahead and commit your patch if there are no other objections.
Comment 5 Adam Jackson 2005-10-21 12:10:39 UTC
applied (finally), 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.