MaskRay added a comment.

In D58892#1784119 <https://reviews.llvm.org/D58892#1784119>, @mgorny wrote:

> In D58892#1783042 <https://reviews.llvm.org/D58892#1783042>, @MaskRay wrote:
>
> > In D58892#1783029 <https://reviews.llvm.org/D58892#1783029>, @mgorny wrote:
> >
> > > I know I'm late to the party but this change thoroughly destroyed NetBSD 
> > > support. The NetBSD loader doesn't support having more than two PT_LOAD 
> > > sections. `-z norosegment` helped with that so far but after this change 
> > > practically everything fails to run.
> >
> >
> > This seems to be a very serious limitation. I have difficult to understand 
> > how such limitation could exist at all, but I think this should be 
> > straightforward to fix.
>
>
> Yes, it is a serious limitation, and no, it's not straightforward to fix. The 
> loader has making a lot of assumptions, especially what PT_LOAD segments to 
> expect and in which order. I've previously made a patch that allowed third 
> segment but it was rejected as apparently 'not doing it the right way'. 
> Almost a year has passed, and I am entirely powerless to fix it.


@mgorny told me that NetBSD ld.so has a limitation that it can only handle 2 
PT_LOAD segments.

I think the NetBSD toolchain team's attitude toward certain ELF things should 
probably be made more flexible. For that particular PT_LOAD limitation issue 
(a.out heritage?), if @mgorny don't mind giving me a pointer, I'd like to help 
argue fixing the limitation.

> If 200 LOC for NetBSD is a show stopper, please see e.g. compiler-rt where we 
> maintain 2 orders of magnitude more NetBSD-only LOC.

I am not sure compiler-rt is a good example here. The "2 orders of magnitude 
more" OS specific things make compiler-rt difficult to maintain. Innovations 
can be easily constrained by the numerous OS specific customization. I am glad 
that lld hasn't entered that situation.

I feel that NetBSD's stubborn attitude is adding complexity to many other 
projects.

> I try to avoid forking LLD for downstream and this shall be appreciated.

If you can accept `DT_RUNPATH` and fix the PT_LOAD limitation, then it seems 
NetBSD just needs its own ld wrapper that adds -L, and probably -znognustack 
which saves you 56 bytes. I don't understand why such customization should 
still be upstreamed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70048/new/

https://reviews.llvm.org/D70048



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to