Skip to contentSkip to conversation

jimtcl: fix sparc64 compile

PATCH New Waldemar Brodkorb 3 participants 4 messages Nov 23, 2015 – Nov 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jimtcl: fix sparc64 compile

It is general safe to use -fPIC for all architectures. -fpic breaks sparc64 compile.

Generally gcc just optimize position independent code for m68k, powerpc and sparc with -fpic.
The size differences are minimal, f.e. for powerpc:

   text    data     bss     dec     hex filename
 235983    5336     684  242003   3b153 output/target/usr/lib/libjim.0.75
 236255    8456     684  245395   3be93 output/target/usr/lib/libjim.so.0.75

So instead of keeping special settings for sparc64 it would be better to always use -fPIC in general.

Runtime tested on Qemu ARM, MIPS, PPC and SPARC64. Fixes:
http://autobuild.buildroot.net/results/98f391ad13f22828c022f185c0166daabdb4c1ad/

---
 package/jimtcl/jimtcl.mk |    3 +++
 1 file changed, 3 insertions(+)
package/jimtcl/jimtcl.mk +3 -0
index 4afb217..50078e7 100644
@@ -46,7 +46,10 @@ define JIMTCL_CONFIGURE_CMDS
 	)
 endef
 
+# -fPIC works for any architecture
 define JIMTCL_BUILD_CMDS
+	SH_CFLAGS="-fPIC" \
+	SHOBJ_CFLAGS="-fPIC" \
 	$(MAKE) -C $(@D)
 endef
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 jimtcl: fix sparc64 compile

Waldemar,

Quoted 6 lines · Waldemar Brodkorb

It is general safe to use -fPIC for all architectures. -fpic breaks sparc64 compile.

Generally gcc just optimize position independent code for m68k, powerpc and sparc with -fpic.
The size differences are minimal, f.e. for powerpc:

Quoted 6 lines
   text    data     bss     dec     hex filename
 235983    5336     684  242003   3b153 output/target/usr/lib/libjim.0.75
 236255    8456     684  245395   3be93 output/target/usr/lib/libjim.so.0.75

So instead of keeping special settings for sparc64 it would be better to always use -fPIC in general.

So in other words, you're saying that in other packages that add -fPIC only for sparc/sparc64, we should add it unconditionally?

Quoted 1 line

+# -fPIC works for any architecture

I think this comment is a bit useless. It should rather be:

# -fPIC is mandatory to build shared libraries on certain architectures # (e.g. SPARC) and causes no harm or drawbacks on other architectures

package/jimtcl/jimtcl.mk define JIMTCL_CONFIGURE_CMDS · line 54

Quoted 6 lines

define JIMTCL_BUILD_CMDS

package/jimtcl/jimtcl.mk +2 -0
+	SH_CFLAGS="-fPIC" \
+	SHOBJ_CFLAGS="-fPIC" \
 	$(MAKE) -C $(@D)
 endef

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 jimtcl: fix sparc64 compile

Hi Thomas,
Thomas Petazzoni wrote,

Quoted 13 lines

Waldemar,

Quoted 10 lines · Waldemar Brodkorb

It is general safe to use -fPIC for all architectures. -fpic breaks sparc64 compile.

Generally gcc just optimize position independent code for m68k, powerpc and sparc with -fpic.
The size differences are minimal, f.e. for powerpc:

   text    data     bss     dec     hex filename
 235983    5336     684  242003   3b153 output/target/usr/lib/libjim.0.75
 236255    8456     684  245395   3be93 output/target/usr/lib/libjim.so.0.75
Quoted 5 lines
Quoted 2 lines

So instead of keeping special settings for sparc64 it would be better to always use -fPIC in general.

So in other words, you're saying that in other packages that add -fPIC only for sparc/sparc64, we should add it unconditionally?

Yes. I think we should get those patches upstream. I hope they don't come up with any reasons for -fpic. I can't see any in our use case.

Quoted 6 lines
Quoted 1 line

+# -fPIC works for any architecture

I think this comment is a bit useless. It should rather be:

# -fPIC is mandatory to build shared libraries on certain architectures # (e.g. SPARC) and causes no harm or drawbacks on other architectures

Can you fix it before commit? :=)

best regards
Waldemar

#3 lore raw

PATCH 1/1 jimtcl: fix sparc64 compile

In reply to Waldemar Brodkorb
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Waldemar" == Waldemar Brodkorb <[email protected]> writes:

It is general safe to use -fPIC for all architectures. -fpic breaks sparc64 compile.

Generally gcc just optimize position independent code for m68k, powerpc and sparc with -fpic.
The size differences are minimal, f.e. for powerpc:

   text    data     bss     dec     hex filename
 235983    5336     684  242003   3b153 output/target/usr/lib/libjim.0.75
 236255    8456     684  245395   3be93 output/target/usr/lib/libjim.so.0.75
Quoted 8 lines

So instead of keeping special settings for sparc64 it would be better to always use -fPIC in general.

Runtime tested on Qemu ARM, MIPS, PPC and SPARC64. Fixes:
http://autobuild.buildroot.net/results/98f391ad13f22828c022f185c0166daabdb4c1ad/

Committed after changing the comment as suggested by Thomas, thanks.

Signature · 1 line
Bye, Peter Korsgaard