Apparently gcc -Wl,--gc-sections doesn't remove unused functions written in assembly code, even if the .S file is compiled with -ffunction-sections. objdump -x doesn't show the code in its own ELF section.
I could manually add a .section in front of each function but that would be painstaking. Is there another way?