Compiling libsepol with -fPIC instead of -fpic
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
src/Makefile +2 -2
@@ -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)
Signature · 4 lines
You can always pick up your needle and move to another groove. Tim Leary Manoj Srivastava <[email protected]> <[email protected]> 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
Karl MacMillan
Acked-byQuoted 35 lines · Manoj Srivastava
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
------------------------------------------------------------------------
src/Makefile +0
-0@@ -24,10 +24,10 @@ ln -sf $@ $(TARGET)
src/Makefile line 33
Quoted 10 lines
src/Makefile +2
-2%.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)
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 42 lines · Karl MacMillan
Quoted 41 lines · Manoj Srivastava
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
------------------------------------------------------------------------
src/Makefile +2
-2@@ -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 $@ $<
Quoted 5 lines
src/Makefile line 33
Quoted 4 lines
src/Makefile +0
-0install: all test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)Acked-by Karl MacMillan <[email protected]>
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.
Signature · 8 lines
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 [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 12 lines · Stephen Smalley
Quoted 3 lines · Karl MacMillan
Manoj Srivastava wrote:
Acked-by Karl MacMillan <[email protected]>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 [email protected] with the words "unsubscribe selinux" without quotes as the message.
Stephen Smalley
Acked-byQuoted 9 lines · Karl MacMillan
Quoted 8 lines · Stephen Smalley
Quoted 3 lines · Karl MacMillan
Manoj Srivastava wrote:
Acked-by Karl MacMillan <[email protected]>Is the problem truly limited to libsepol, or is it also an issue with libsemanage and/or libselinux?
Quoted 7 lines
Quoted 4 lines
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.
Signature · 8 lines
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 [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 12 lines · Stephen Smalley
Quoted 11 lines · Karl MacMillan
Quoted 10 lines · Stephen Smalley
Quoted 2 lines · Karl MacMillan
Manoj Srivastava wrote:
Acked-by Karl MacMillan <[email protected]>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.
Quoted 7 lines
Quoted 1 line
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 <[email protected]>
Committed the following:
src/Makefile +1 -1
@@ -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) $^
ChangeLog +5 -0
@@ -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.
VERSION +1 -1
@@ -1 +1 @@ -1.8 +1.8.1
src/Makefile +2 -2
@@ -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)
ChangeLog +5 -0
@@ -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.
VERSION +1 -1
@@ -1 +1 @@ -1.15.2 +1.15.3
src/Makefile +1 -1
@@ -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) $^
ChangeLog +5 -0
@@ -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
VERSION +1 -1
@@ -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 [email protected] with the words "unsubscribe selinux" without quotes as the message.