[PATCH] D29273: [ELF] - Added support of linkerscript's "/DISCARD/" for --emit-relocs

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 02:16:00 PST 2017


I prepared D30033 to address below cases.

>Also, can we chain dependent sections? We can write them:
>
>-------------------------------------
>.section .foo,"a"
>.quad 0
>.section .bar,"am", at progbits,.foo
>.quad 0
>.section .zed,"am", at progbits,.bar
>.quad 0
>-------------------------------------
>
>and we should either reject them or handle them, but not crash.

D30033 handles that.

>What I would suggest is:
>
>* Create a new review that just changes DependentSection to a
>  TinyPtrVector. That should fix the handling of
>
>.section foo,"a"
>.quad 0
>.section .bar,"am", at progbits,foo
>.quad 0
>.section .zed,"am", at progbits,foo
>.quad 0
>
>We currently gc .bar since we just remember the last dependent section.
>
>* With that in your change to put reloc sections as dependent sections
>  when using -emit-relocs is reasonable. I am not convinced about the
>  direct logic in LinkerScript. It seems that we should just run the
>  marklive algorithm, but with the majority of sections already marked
>  live so that it only has to check SHF_LINK_ORDER and relocation
>  sections.

I think D30033 implements what reduced marklive algorithm would do.
It seems all what we need is discard a sections dependency subtree where head 
is a section discarded by script. I can't imagine simpler implementation.

George.


More information about the llvm-commits mailing list