FS#12144 - Use -fPIC -fvisibility=hidden for 32 bit x86 builds too to fix link errors.

Attached to Project: Rockbox
Opened by Nils Wallménius (nls) - Wednesday, 01 June 2011, 09:45 GMT
Last edited by Andree Buschmann (Buschel) - Friday, 24 June 2011, 08:59 GMT
Task Type Patches
Category Build environment
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch enables the -fPIC and -fvisibility=hidden options for 32 x86 builds, they were previously only used for 64 bit. This fixes or works around linker errors with recent binutils in debian but i'm unsure if there are any downsides to this
This task depends upon

Closed by  Andree Buschmann (Buschel)
Friday, 24 June 2011, 08:59 GMT
Reason for closing:  Accepted
Additional comments about closing:  Latest fixes for cygwin and win32 corss-compiliation under Linux have been submitted.
Comment by Nils Wallménius (nls) - Wednesday, 01 June 2011, 12:10 GMT
Better patch that only uses the -fPIC flag for things that are actually shared, introduces a new SHARED_CFLAGS flag to set in configure.
Works fine on both 64 and 32 bit sims here. Dunno about other platforms that use "-shared" like maemo and android.
Also it breaks on the sscanf hack in doom and rockboy, which should be fixed.
Comment by Nils Wallménius (nls) - Tuesday, 07 June 2011, 08:27 GMT
doom and rockboy fixed by adding sscanf to their SOURCES files so that it gets compiled with the correct flags
Comment by Andree Buschmann (Buschel) - Monday, 20 June 2011, 20:19 GMT
The current solution (since r29983) throws lots of "fPIC"- and "visibility"-related warnings when building win32 simulation under Linux (Ubuntu). Commenting line 299 in /tools/configure does of course solve this issue.

Edit: compile log attached.
   log.7z (87.4 KiB)
Comment by Steve Bavin (pondlife) - Tuesday, 21 June 2011, 07:52 GMT
FYI I also need to remove the -fvisibilityoption to get a Cygwin build to work. The standard Cygwin setup still uses gcc 3.4.4 which doesn't know about -fvisibility. The -fPIC option does give plenty of warnings, but the compilation still succeeds.
Comment by Nils Wallménius (nls) - Tuesday, 21 June 2011, 08:29 GMT
Can you make the switches conditional on mingw or cygwin or whatever in configure?
I don't have a setup to test that stuff
Comment by Andree Buschmann (Buschel) - Tuesday, 21 June 2011, 19:19 GMT
This fixes the issues with the win32 build for both Linux (Ubuntu) and cygwin hosts. I am not sure whether this might be needed for other hosts as well...
Comment by Andree Buschmann (Buschel) - Wednesday, 22 June 2011, 17:50 GMT
Fix submitted with r30052. I am not sure whether this kind of fix is also needed for some of the other environments as well.