Command line option -PIC accepted on armhf but nowhere else?

Bug #1087171 reported by Tony Kelman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-defaults (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The following minimal test case reproduces the problem:
echo "int main () {}" > test.c && gcc -c -o test.o test.c && gcc -o test -PIC test.o && echo "succeeds"

On every other architecture I've tried, the -PIC flag results in "gcc: error: unrecognized option '-PIC'" which is the typically expected behavior here. Apologies if this counts as a linker bug and should not be filed under gcc.

The unexpected success on armhf in Precise is confusing the build system of PETSc such that package libpetsc3.1-dev is failing to build shared libraries. If this is actually a feature rather than a bug of this version/arch of gcc or ld then this could be considered a bug in PETSc's build system instead.

You can see the effect this has on PETSc in its configure.log (/usr/lib/petscdir/3.1/$PETSC_ARCH/conf/configure.log, see the tests checkPIC and checkSharedLinker). Normally the test fails with '-PIC', so it moves on to try '-fPIC' which works correctly for building shared libraries.

It does look as though this has been fixed in Quantal, but the unexpected behavior remains in Precise.

ProblemType: Bug
DistroRelease: Linaro 12.11
Package: gcc 4:4.6.3-1ubuntu5
Uname: Linux 3.2.1-linaro-omap armv7l
ApportVersion: 2.0.1-0ubuntu15
Architecture: armhf
Date: Thu Dec 6 08:24:38 2012
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 LANG=C.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Tony Kelman (tkelman) wrote :
Revision history for this message
Tony Kelman (tkelman) wrote :

Update: on Quantal, the bug is fixed with gcc-4.7, but still present with gcc-4.6.

Revision history for this message
Matthias Klose (doko) wrote :

fixed in trusty, won't fix for the older releases

Changed in gcc-defaults (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.