Roger Pau Monné via llvm-dev
2019-Jun-20 14:18 UTC
[llvm-dev] LLD handling of orphaned sections
Hello, The handling of orphaned sections in LLD 8 has changed from GNU LD behavior (note that LLD 7 didn't show this behavior). I've reported this as: https://bugs.llvm.org/show_bug.cgi?id=42327 It's not clear to me however whether this is intentional or a regression when compared to LLD 7. As stated in that bug report it would be helpful for me to get some kind of documentation that describes LLD intended handling of orphaned sections, so that I can justify fixes in order to support LLD, and that I can be sure what I modify is going to be robust against future changes in LLD. For example GNU LD has: https://sourceware.org/binutils/docs/ld/Orphan-Sections.html Having something like this for LLD (if it's going to diverge from GNU LD behavior) would be very helpful, and would allow me to implement future proof support for LLD in Xen. Thanks, Roger.
Rui Ueyama via llvm-dev
2019-Jun-21 12:04 UTC
[llvm-dev] LLD handling of orphaned sections
I think Geroge (cc'ed) knows better than me in that area. lld is underdocumented, and in particular there is virtually no documentation about its linker script support. Our basic strategy is to follow the GNU's documentation and the implementations unless it is too hard or doesn't match with the rest of lld. So, as long as it works just like GNU, it's fine, but if not, it is hard to say whether it is intended or not, just as you explained. This is an area that we need to improve. On Thu, Jun 20, 2019 at 11:18 PM Roger Pau Monné via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > The handling of orphaned sections in LLD 8 has changed from GNU LD > behavior (note that LLD 7 didn't show this behavior). I've reported > this as: > > https://bugs.llvm.org/show_bug.cgi?id=42327 > > It's not clear to me however whether this is intentional or a > regression when compared to LLD 7. > > As stated in that bug report it would be helpful for me to get some > kind of documentation that describes LLD intended handling of orphaned > sections, so that I can justify fixes in order to support LLD, and > that I can be sure what I modify is going to be robust against future > changes in LLD. For example GNU LD has: > > https://sourceware.org/binutils/docs/ld/Orphan-Sections.html > > Having something like this for LLD (if it's going to diverge from GNU > LD behavior) would be very helpful, and would allow me to implement > future proof support for LLD in Xen. > > Thanks, Roger. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190621/2d2c888b/attachment.html>
Peter Smith via llvm-dev
2019-Jun-21 12:27 UTC
[llvm-dev] LLD handling of orphaned sections
On Fri, 21 Jun 2019 at 13:05, Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > I think Geroge (cc'ed) knows better than me in that area. > > lld is underdocumented, and in particular there is virtually no documentation about its linker script support. Our basic strategy is to follow the GNU's documentation and the implementations unless it is too hard or doesn't match with the rest of lld. So, as long as it works just like GNU, it's fine, but if not, it is hard to say whether it is intended or not, just as you explained. This is an area that we need to improve. >I think it would be helpful if we could come up with some user-level documentation on the intentional differences between LLD and GNU ld, particularly in the less well specified areas like orphan section assignment and program header generation. I think we'd have to be very careful with what we wrote down though, to a first approximation we have differences that are intentional or non-intentional; and on a separate axis differences that are stable or subject to change. We'd want to concentrate on documenting differences that are intentional and stable, such as back references being allowed in library selection. If there is interest in working this out I'm willing to start a list of the differences, whether it is in the document or just a text file alongside the source. It is something that could be built up incrementally and over time we can identify the stable differences? Peter> On Thu, Jun 20, 2019 at 11:18 PM Roger Pau Monné via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hello, >> >> The handling of orphaned sections in LLD 8 has changed from GNU LD >> behavior (note that LLD 7 didn't show this behavior). I've reported >> this as: >> >> https://bugs.llvm.org/show_bug.cgi?id=42327 >> >> It's not clear to me however whether this is intentional or a >> regression when compared to LLD 7. >> >> As stated in that bug report it would be helpful for me to get some >> kind of documentation that describes LLD intended handling of orphaned >> sections, so that I can justify fixes in order to support LLD, and >> that I can be sure what I modify is going to be robust against future >> changes in LLD. For example GNU LD has: >> >> https://sourceware.org/binutils/docs/ld/Orphan-Sections.html >> >> Having something like this for LLD (if it's going to diverge from GNU >> LD behavior) would be very helpful, and would allow me to implement >> future proof support for LLD in Xen. >> >> Thanks, Roger. >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Roger Pau Monné via llvm-dev
2019-Jun-21 15:08 UTC
[llvm-dev] LLD handling of orphaned sections
On Fri, Jun 21, 2019 at 09:04:34PM +0900, Rui Ueyama wrote:> I think Geroge (cc'ed) knows better than me in that area.Thanks for the reply.> lld is underdocumented, and in particular there is virtually no > documentation about its linker script support. Our basic strategy is to > follow the GNU's documentation and the implementations unless it is too > hard or doesn't match with the rest of lld.Here LLD is diverging from GNU ld, and TBH I think this is going to cause issues to other projects that also use linker scripts. One of the reasons of using linker scripts is to have fine grained control about section placement. Without a formal statement about LLD behaviour regarding orphaned section handling in linker scripts the only option to have fine grained control is to use --orphan-handling=error and thus to be sure every input section is handled, which is likely to be hard to justify as a change in order to support LLD.> So, as long as it works just > like GNU, it's fine, but if not, it is hard to say whether it is intended > or not, just as you explained. This is an area that we need to improve.As I understand it when there's no linker script LLD has a lot more freedom to layout sections differently from GNU ld, but I think doing it for the linker script case is likely to cause trouble in the long run for projects trying to switch to LLD or trying to support both GNU ld and LLD (like Xen). Roger.> On Thu, Jun 20, 2019 at 11:18 PM Roger Pau Monné via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > Hello, > > > > The handling of orphaned sections in LLD 8 has changed from GNU LD > > behavior (note that LLD 7 didn't show this behavior). I've reported > > this as: > > > > https://bugs.llvm.org/show_bug.cgi?id=42327 > > > > It's not clear to me however whether this is intentional or a > > regression when compared to LLD 7. > > > > As stated in that bug report it would be helpful for me to get some > > kind of documentation that describes LLD intended handling of orphaned > > sections, so that I can justify fixes in order to support LLD, and > > that I can be sure what I modify is going to be robust against future > > changes in LLD. For example GNU LD has: > > > > https://sourceware.org/binutils/docs/ld/Orphan-Sections.html > > > > Having something like this for LLD (if it's going to diverge from GNU > > LD behavior) would be very helpful, and would allow me to implement > > future proof support for LLD in Xen. > > > > Thanks, Roger. > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >
Maybe Matching Threads
- LLD handling of orphaned sections
- LLD : __start_ and __end_ symbols for orphan sections
- LLD : __start_ and __end_ symbols for orphan sections
- LLD : __start_ and __end_ symbols for orphan sections
- libxl device_disk_add orphans blktap devices on transaction error