* Compiling libsepol with -fPIC instead of -fpic
@ 2006-11-15 6:45 Manoj Srivastava
2006-11-20 17:05 ` Karl MacMillan
0 siblings, 1 reply; 6+ messages in thread
From: Manoj Srivastava @ 2006-11-15 6:45 UTC (permalink / raw)
To: selinux
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Hi,
I've had reports of packages filing to compile on SPARC
hardware when linked with libsepol1 which was compiled with
-fpic. We seem to be hitting the global offset table size limit;
,----[ GCC manual ]
| `-fpic'
| Generate position-independent code (PIC) suitable for use in a
| shared library, if supported for the target machine. Such code
| accesses all constant addresses through a global offset table
| (GOT). The dynamic loader resolves the GOT entries when the
| program starts (the dynamic loader is not part of GCC; it is part
| of the operating system). If the GOT size for the linked
| executable exceeds a machine-specific maximum size, you get an
| error message from the linker indicating that `-fpic' does not
| work; in that case, recompile with `-fPIC' instead. (These
| maximums are 8k on the SPARC and 32k on the m68k and RS/6000. The
| 386 has no such limit.)
`----
Simply recompiling with -fPIC corrects the problem.
manoj
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 559 bytes --]
--- orig/src/Makefile
+++ mod/src/Makefile
@@ -24,10 +24,10 @@
ln -sf $@ $(TARGET)
%.o: %.c
- $(CC) $(CFLAGS) -fpic -c -o $@ $<
+ $(CC) $(CFLAGS) -fPIC -c -o $@ $<
%.lo: %.c
- $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $<
+ $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
install: all
test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
--
You can always pick up your needle and move to another groove. Tim
Leary
Manoj Srivastava <manoj.srivastava@stdc.com> <srivasta@acm.org>
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Compiling libsepol with -fPIC instead of -fpic 2006-11-15 6:45 Compiling libsepol with -fPIC instead of -fpic Manoj Srivastava @ 2006-11-20 17:05 ` Karl MacMillan 2006-11-21 21:05 ` Stephen Smalley 0 siblings, 1 reply; 6+ messages in thread From: Karl MacMillan @ 2006-11-20 17:05 UTC (permalink / raw) To: Manoj Srivastava; +Cc: selinux Manoj Srivastava wrote: > Hi, > > I've had reports of packages filing to compile on SPARC > hardware when linked with libsepol1 which was compiled with > -fpic. We seem to be hitting the global offset table size limit; > ,----[ GCC manual ] > | `-fpic' > | Generate position-independent code (PIC) suitable for use in a > | shared library, if supported for the target machine. Such code > | accesses all constant addresses through a global offset table > | (GOT). The dynamic loader resolves the GOT entries when the > | program starts (the dynamic loader is not part of GCC; it is part > | of the operating system). If the GOT size for the linked > | executable exceeds a machine-specific maximum size, you get an > | error message from the linker indicating that `-fpic' does not > | work; in that case, recompile with `-fPIC' instead. (These > | maximums are 8k on the SPARC and 32k on the m68k and RS/6000. The > | 386 has no such limit.) > `---- > > Simply recompiling with -fPIC corrects the problem. > > manoj > > > > ------------------------------------------------------------------------ > > --- orig/src/Makefile > +++ mod/src/Makefile > @@ -24,10 +24,10 @@ > ln -sf $@ $(TARGET) > > %.o: %.c > - $(CC) $(CFLAGS) -fpic -c -o $@ $< > + $(CC) $(CFLAGS) -fPIC -c -o $@ $< > > %.lo: %.c > - $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< > + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< > > install: all > test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) > > Acked-by: Karl MacMillan <kmacmillan@mentalrootkit.com> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling libsepol with -fPIC instead of -fpic 2006-11-20 17:05 ` Karl MacMillan @ 2006-11-21 21:05 ` Stephen Smalley 2006-11-21 21:28 ` Karl MacMillan 0 siblings, 1 reply; 6+ messages in thread From: Stephen Smalley @ 2006-11-21 21:05 UTC (permalink / raw) To: Karl MacMillan; +Cc: Manoj Srivastava, selinux On Mon, 2006-11-20 at 12:05 -0500, Karl MacMillan wrote: > Manoj Srivastava wrote: > > Hi, > > > > I've had reports of packages filing to compile on SPARC > > hardware when linked with libsepol1 which was compiled with > > -fpic. We seem to be hitting the global offset table size limit; > > ,----[ GCC manual ] > > | `-fpic' > > | Generate position-independent code (PIC) suitable for use in a > > | shared library, if supported for the target machine. Such code > > | accesses all constant addresses through a global offset table > > | (GOT). The dynamic loader resolves the GOT entries when the > > | program starts (the dynamic loader is not part of GCC; it is part > > | of the operating system). If the GOT size for the linked > > | executable exceeds a machine-specific maximum size, you get an > > | error message from the linker indicating that `-fpic' does not > > | work; in that case, recompile with `-fPIC' instead. (These > > | maximums are 8k on the SPARC and 32k on the m68k and RS/6000. The > > | 386 has no such limit.) > > `---- > > > > Simply recompiling with -fPIC corrects the problem. > > > > manoj > > > > > > > > ------------------------------------------------------------------------ > > > > --- orig/src/Makefile > > +++ mod/src/Makefile > > @@ -24,10 +24,10 @@ > > ln -sf $@ $(TARGET) > > > > %.o: %.c > > - $(CC) $(CFLAGS) -fpic -c -o $@ $< > > + $(CC) $(CFLAGS) -fPIC -c -o $@ $< > > > > %.lo: %.c > > - $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< > > + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< > > > > install: all > > test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) > > > > > Acked-by: Karl MacMillan <kmacmillan@mentalrootkit.com> Is the problem truly limited to libsepol, or is it also an issue with libsemanage and/or libselinux? Possibly we could define it as a variable in the Makefile (e.g. PIC ?= -fpic) with a default of -fpic and allow you to build them with make PIC=-fPIC on SPARC to avoid any effect on x86. -- Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling libsepol with -fPIC instead of -fpic 2006-11-21 21:05 ` Stephen Smalley @ 2006-11-21 21:28 ` Karl MacMillan 2006-11-22 15:58 ` Stephen Smalley 0 siblings, 1 reply; 6+ messages in thread From: Karl MacMillan @ 2006-11-21 21:28 UTC (permalink / raw) To: Stephen Smalley; +Cc: Manoj Srivastava, selinux Stephen Smalley wrote: > On Mon, 2006-11-20 at 12:05 -0500, Karl MacMillan wrote: >> Manoj Srivastava wrote: >> Acked-by: Karl MacMillan <kmacmillan@mentalrootkit.com> > > Is the problem truly limited to libsepol, or is it also an issue with > libsemanage and/or libselinux? > > Possibly we could define it as a variable in the Makefile (e.g. PIC ?= > -fpic) with a default of -fpic and allow you to build them with make > PIC=-fPIC on SPARC to avoid any effect on x86. > The docs claim an effect only on m68k, PowerPC, and SPARC. So it should be safe to replace this globally for all of our code. Karl -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling libsepol with -fPIC instead of -fpic 2006-11-21 21:28 ` Karl MacMillan @ 2006-11-22 15:58 ` Stephen Smalley 2006-11-27 19:12 ` Karl MacMillan 0 siblings, 1 reply; 6+ messages in thread From: Stephen Smalley @ 2006-11-22 15:58 UTC (permalink / raw) To: Karl MacMillan; +Cc: Manoj Srivastava, selinux On Tue, 2006-11-21 at 16:28 -0500, Karl MacMillan wrote: > Stephen Smalley wrote: > > On Mon, 2006-11-20 at 12:05 -0500, Karl MacMillan wrote: > >> Manoj Srivastava wrote: > > >> Acked-by: Karl MacMillan <kmacmillan@mentalrootkit.com> > > > > Is the problem truly limited to libsepol, or is it also an issue with > > libsemanage and/or libselinux? > > > > Possibly we could define it as a variable in the Makefile (e.g. PIC ?= > > -fpic) with a default of -fpic and allow you to build them with make > > PIC=-fPIC on SPARC to avoid any effect on x86. > > > > The docs claim an effect only on m68k, PowerPC, and SPARC. So it should > be safe to replace this globally for all of our code. Ok. Particularly given that both libsemanage and libselinux now depend on libsepol. Acked-by: Stephen Smalley <sds@tycho.nsa.gov> -- Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling libsepol with -fPIC instead of -fpic 2006-11-22 15:58 ` Stephen Smalley @ 2006-11-27 19:12 ` Karl MacMillan 0 siblings, 0 replies; 6+ messages in thread From: Karl MacMillan @ 2006-11-27 19:12 UTC (permalink / raw) To: Stephen Smalley; +Cc: Manoj Srivastava, selinux Stephen Smalley wrote: > On Tue, 2006-11-21 at 16:28 -0500, Karl MacMillan wrote: >> Stephen Smalley wrote: >>> On Mon, 2006-11-20 at 12:05 -0500, Karl MacMillan wrote: >>>> Manoj Srivastava wrote: >>>> Acked-by: Karl MacMillan <kmacmillan@mentalrootkit.com> >>> Is the problem truly limited to libsepol, or is it also an issue with >>> libsemanage and/or libselinux? >>> >>> Possibly we could define it as a variable in the Makefile (e.g. PIC ?= >>> -fpic) with a default of -fpic and allow you to build them with make >>> PIC=-fPIC on SPARC to avoid any effect on x86. >>> >> The docs claim an effect only on m68k, PowerPC, and SPARC. So it should >> be safe to replace this globally for all of our code. > > Ok. Particularly given that both libsemanage and libselinux now depend > on libsepol. > > Acked-by: Stephen Smalley <sds@tycho.nsa.gov> > Committed the following: Index: libsemanage/src/Makefile =================================================================== --- libsemanage/src/Makefile (revision 2100) +++ libsemanage/src/Makefile (working copy) @@ -44,7 +44,7 @@ pywrap: all $(SWIGLOBJ) $(SWIGSO) $(SWIGLOBJ): $(SWIGCOUT) - $(CC) $(CFLAGS) -I$(PYINC) -fpic -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGSO): $(SWIGLOBJ) $(CC) $(LDFLAGS) -shared -o $@ $< -L. -lsemanage -l$(PYLIBVER) -L$(LIBDIR) -Wl,-soname,$@,-z,defs @@ -69,7 +69,7 @@ $(CC) $(CFLAGS) -c -o $@ $< %.lo: %.c - $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< $(SWIGCOUT): $(SWIGIF) $(SWIG) $^ Index: libsemanage/ChangeLog =================================================================== --- libsemanage/ChangeLog (revision 2100) +++ libsemanage/ChangeLog (working copy) @@ -1,3 +1,8 @@ +1.8.1 2006-11-27 + * Merged patch to compile wit -fPIC instead of -fpic from + Manoj Srivastava to prevent hitting the global offest table + limit. Patch changed to include libselinux and libsemanage in + addition to libselinux. 1.8 2006-10-17 * Updated version for release. Index: libsemanage/VERSION =================================================================== --- libsemanage/VERSION (revision 2100) +++ libsemanage/VERSION (working copy) @@ -1 +1 @@ -1.8 +1.8.1 Index: libsepol/src/Makefile =================================================================== --- libsepol/src/Makefile (revision 2100) +++ libsepol/src/Makefile (working copy) @@ -24,10 +24,10 @@ ln -sf $@ $(TARGET) %.o: %.c - $(CC) $(CFLAGS) -fpic -c -o $@ $< + $(CC) $(CFLAGS) -fPIC -c -o $@ $< %.lo: %.c - $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< install: all test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) Index: libsepol/ChangeLog =================================================================== --- libsepol/ChangeLog (revision 2100) +++ libsepol/ChangeLog (working copy) @@ -1,3 +1,8 @@ +1.15.3 2006-11-27 + * Merged patch to compile wit -fPIC instead of -fpic from + Manoj Srivastava to prevent hitting the global offest table + limit. Patch changed to include libselinux and libsemanage in + addition to libselinux. 1.15.2 2006-10-31 * Merged fix from Karl MacMillan for a segfault when linking non-MLS modules with users in them. Index: libsepol/VERSION =================================================================== --- libsepol/VERSION (revision 2100) +++ libsepol/VERSION (working copy) @@ -1 +1 @@ -1.15.2 +1.15.3 Index: libselinux/src/Makefile =================================================================== --- libselinux/src/Makefile (revision 2100) +++ libselinux/src/Makefile (working copy) @@ -42,7 +42,7 @@ $(RANLIB) $@ $(SWIGLOBJ): $(SWIGCOUT) - $(CC) $(CFLAGS) -I$(PYINC) -fpic -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGSO): $(SWIGLOBJ) $(CC) $(LDFLAGS) -shared -o $@ $< -L. -lselinux -L$(LIBDIR) -Wl,-soname,$@ @@ -55,7 +55,7 @@ $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $< %.lo: %.c policy.h - $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< $(SWIGCOUT): $(SWIGIF) $(SWIG) $^ Index: libselinux/ChangeLog =================================================================== --- libselinux/ChangeLog (revision 2100) +++ libselinux/ChangeLog (working copy) @@ -1,3 +1,8 @@ +1.33.2 2006-11-27 + * Merged patch to compile wit -fPIC instead of -fpic from + Manoj Srivastava to prevent hitting the global offest table + limit. Patch changed to include libselinux and libsemanage in + addition to libselinux. 1.33.1 2006-10-19 * Merged updated flask definitions from Darrel Goeddel. This adds the context security class, and also adds Index: libselinux/VERSION =================================================================== --- libselinux/VERSION (revision 2100) +++ libselinux/VERSION (working copy) @@ -1 +1 @@ -1.33.1 +1.33.2 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-11-27 19:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-11-15 6:45 Compiling libsepol with -fPIC instead of -fpic Manoj Srivastava 2006-11-20 17:05 ` Karl MacMillan 2006-11-21 21:05 ` Stephen Smalley 2006-11-21 21:28 ` Karl MacMillan 2006-11-22 15:58 ` Stephen Smalley 2006-11-27 19:12 ` Karl MacMillan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.