Moshtaghi, Alireza via llvm-dev
2020-Nov-15 08:20 UTC
[llvm-dev] lld error: output file too large <some large number>
Hi I’m having a trouble linking a special program with lld and the above error is generated. I narrowed it down to lld/Writer.cpp:getFileAlignment (). (Well, my local repository is from a while back (version 10) and for me it is lld/Writer.cpp:computeFileOffset ()) Either way, where it is calculating the file offset when two sections share same PT_LOAD, the formula used is off2 = off1 + (VA2 – VA1) but the subtraction is causing a negative number, causing out of bound value… Should this be abs(VA2 – VA1) ? Or Should it be cast to a signed integer so we subtract the difference rather than adding the large value? Thanks A. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201115/84259659/attachment.html>
Fāng-ruì Sòng via llvm-dev
2020-Nov-16 07:19 UTC
[llvm-dev] lld error: output file too large <some large number>
Hi Alireza, getFileAlignment was renamed in Oct 2018. It seems that you may have sectionA and sectionB in one PT_LOAD while sectionB has a lower address. This is invalid. Can you provide more information about how you have a sectionB with a lower address? Note that LLD has an error "unable to move location counter backward for: ". On Sun, Nov 15, 2020 at 12:20 AM Moshtaghi, Alireza via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi > > I’m having a trouble linking a special program with lld and the above error is generated. > > I narrowed it down to lld/Writer.cpp:getFileAlignment (). > > (Well, my local repository is from a while back (version 10) and for me it is lld/Writer.cpp:computeFileOffset ()) > > Either way, where it is calculating the file offset when two sections share same PT_LOAD, the formula used is off2 = off1 + (VA2 – VA1) but the subtraction is causing a negative number, causing out of bound value… > > > > Should this be abs(VA2 – VA1) ? > > Or > > Should it be cast to a signed integer so we subtract the difference rather than adding the large value? > > > > Thanks > > A. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- 宋方睿
Moshtaghi, Alireza via llvm-dev
2020-Nov-16 17:05 UTC
[llvm-dev] lld error: output file too large <some large number>
My target requires that text section be at 0x0 so "-Ttext 0x0" is passed to the linker. When I link with gold, it goes through; but lld fails. Instead of always returning the same calculation, when I change the calculation to the following, it links: return first->offset + (os->addr > first->addr ? os->addr - first->addr : os->addr); There are other things in the build that I need to fix so I can't tell if the result is correct yet though. Do you think this is correct? Thanks A On 11/15/20, 11:19 PM, "Fāng-ruì Sòng" <maskray at google.com> wrote: NetApp Security WARNING: This is an external email. Do not click links or open attachments unless you recognize the sender and know the content is safe. Hi Alireza, getFileAlignment was renamed in Oct 2018. It seems that you may have sectionA and sectionB in one PT_LOAD while sectionB has a lower address. This is invalid. Can you provide more information about how you have a sectionB with a lower address? Note that LLD has an error "unable to move location counter backward for: ". On Sun, Nov 15, 2020 at 12:20 AM Moshtaghi, Alireza via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi > > I’m having a trouble linking a special program with lld and the above error is generated. > > I narrowed it down to lld/Writer.cpp:getFileAlignment (). > > (Well, my local repository is from a while back (version 10) and for me it is lld/Writer.cpp:computeFileOffset ()) > > Either way, where it is calculating the file offset when two sections share same PT_LOAD, the formula used is off2 = off1 + (VA2 – VA1) but the subtraction is causing a negative number, causing out of bound value… > > > > Should this be abs(VA2 – VA1) ? > > Or > > Should it be cast to a signed integer so we subtract the difference rather than adding the large value? > > > > Thanks > > A. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -- 宋方睿
Reasonably Related Threads
- lld error: output file too large <some large number>
- lld error: output file too large <some large number>
- lld error: output file too large <some large number>
- lld error: output file too large <some large number>
- lld error: output file too large <some large number>