From the bottom of any auto-generated STM32CubeMx-generated linker script:
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
Looks like in this example, /DISCARD/ removes any other sections, that are not explicitly defined by script. For example, since *(.text), *(.data), *(.bss), *(.init_array) etc, has been defined earlier in the script, they get into the ELF. But libc, libm or libgcc could contain unnecessary sections for firmware (e.g. .foo, .bar, .debug ...), so /DISCARD/ just wipes them out, but NOT all sections!