https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77464
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Basically -no-pie says you are now doing an executable overriding the previous -shared. This is not a bug, you want -no-pie -shared. So if you want to disable pie for some building just set CC (and CXX and LD) to be "gcc -no-pie" and that will work the way you think it will work. It won't override if the application understands it wants pie but it also allows shared libraries to work correctly.