[lld] section attributes lld can use to safely drop a section from obj files

Hello llvm\lld,

The autlolink feature in swift appends a section to the obj files (.swift1_autolink_entries) that is later need to determine what t link against in the final linked binary.

I am trying to get rid of these section in the final linked binary at link time. I understand this could be done with (llvm-objcopy --remove-section=.swift1_autolink_entries) but would like have the linker

do it.

Is there an attribute I can set in that section that the linker can safely drop such a section?

Thank you,

I guess I will ask the obvious question: Can Swift be migrated to the .deplibs feature that was added to ELF LLD instead?

I don’t know the answer to your original question, unfortunately.

Yeah, there is an attribute you can use to tell the linker to ignore a section, SHF_EXCLUDE. it was used for some DWARF stuff here: https://reviews.llvm.org/D52303

Yeah, there is an attribute you can use to tell the linker to ignore a section, SHF_EXCLUDE. it was used for some DWARF stuff here: https://reviews.llvm.org/D52303

YES, that is what I am looking for!!.

Too bad there is no simple mechanism to attach section attributes for a Global in LLVM IR.

Yeah, there is an attribute you can use to tell the linker to ignore a section, SHF_EXCLUDE. it was used for some DWARF stuff here: https://reviews.llvm.org/D52303

I guess I will ask the obvious question: Can Swift be migrated to the .deplibs feature that was added to ELF LLD instead?

Hmm, I think a switch to the .dplibs or .linker options is possible. Maybe Saleem can chime in on this.