https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94504
--- Comment #5 from Michael Karcher <gcc-bugzilla at mkarcher dot dialup.fu-berlin.de> --- I got the command line of gcc wrong. "-pie" just sets the linker flags for PIE linking, but it does *not* compile source code as PIE. If I use "-fpie", garbage collection does what it is supposed to do. As I found out, the acutal problem I have is completely unrelated to gcc (sorry for the noise here), because it concerns object files created by rustc (which has an llvm backend) linked by binutil's ld tool. At the moment I was able to reproduce the same symptom I have with those rust objects with a ten-line C program, I considered fixing the problem (if possible) for C first a good idea. As it stands now, the issue in gcc (no effective garbage collection for non-PIE executables with function pointers in global data structures) still stands, so I am not closing the bug right away.