diff --git a/ports/gonk/fake-ld.sh b/ports/gonk/fake-ld.sh index 53c55259be0..0b368e48594 100755 --- a/ports/gonk/fake-ld.sh +++ b/ports/gonk/fake-ld.sh @@ -1,2 +1,9 @@ #!/bin/bash -arm-linux-androideabi-g++ $@ $LDFLAGS -pie -lGLESv2 -L$GONKDIR/backup-flame/system/lib/ + +# Add the position-independent executable flag if not building a shared lib. +if echo $@ | grep -qv " -shared" +then + PIE_FLAG="-pie" +fi +$PIE_FLAG +arm-linux-androideabi-g++ $@ $LDFLAGS $PIE_FLAG -lGLESv2 -L$GONKDIR/backup-flame/system/lib/