Support linktime-gc on Linux with clang

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 27
    • Affects Version/s: 27
    • Component/s: infrastructure
    • None
    • master
    • generic
    • linux

      Currently linktime-gc is only supported with gcc, but the needed compile and linker flags should work too with clang on Linux.
      So it should be supported too on Linux when choosing the clang toolchain .

      While on Linux with clang we get slightly smaller lib when enabling ltgc, on macOS the -ffunction-sections -fdata-sections compile flags seem to cause larger libs (the linker option -Wl,--gc-sections is not available on macOS, but we use the dead_strip linker option already) ,

      On AIX (uses clang too), some kind of section gc is performed already by default by the linker so no need to enable it; see https://www.ibm.com/docs/en/aix/7.2.0?topic=l-ld-command (there is only the nogc option to disable the linktime gc) ;
      the -ffunction-sections -fdata-sections compile flags showed no benefit regarding binary sizes.

            Assignee:
            Matthias Baesken
            Reporter:
            Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: