Re: [Lldb-commits] [lldb] r339974 - Add a relocation for R_AARCH64_ABS32 in ObjectFileELF

2018-08-20 Thread Davide Italiano via lldb-commits
Oh, yeah, indeed (and probably crafting a binary with yaml2obj or
llvm-mc which triggers this reloc should be trivial [you might
consider taking a look at the tests in lld/ELF as probably have tons
of similar examples).
On Mon, Aug 20, 2018 at 12:34 PM Pavel Labath via lldb-commits
 wrote:
>
> On 20/08/18 08:17, Davide Italiano via lldb-commits wrote:
> > On Fri, Aug 17, 2018 at 2:36 AM Stephane Sezer via lldb-commits
> >  wrote:
> >>
> >> Author: sas
> >> Date: Thu Aug 16 17:35:47 2018
> >> New Revision: 339974
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=339974=rev
> >> Log:
> >> Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
> >>
> >> Summary:
> >> .rela.debug_info relocations are being done via
> >> ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
> >> that iterates over the relocation type is only implemented for a few
> >> different types and `assert(false)`es over the rest.
> >>
> >> Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations
> >>
> >> Reviewers: sas, xiaobai, javed.absar, espindola
> >>
> >> Reviewed By: sas
> >>
> >> Subscribers: emaste, arichardson, kristof.beyls
> >>
> >> Differential Revision: https://reviews.llvm.org/D50369
> >>
> >> Change by Nathan Lanza 
> >>
> >
> > This change should be unit testable, can you please give it a shot?
> > Alternatively, you can probably use `lldb-test`, but maybe that
> > requires some infrastructure to be written that's not there yet and I
> > think it's not fair to ask you to write it.
> >
> > --
> > Davide
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> >
>
> lldb-test has the ability to dump the contents of object file sections.
> The applied relocations should be reflected there.
>
> pl
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r339974 - Add a relocation for R_AARCH64_ABS32 in ObjectFileELF

2018-08-20 Thread Pavel Labath via lldb-commits
On 20/08/18 08:17, Davide Italiano via lldb-commits wrote:
> On Fri, Aug 17, 2018 at 2:36 AM Stephane Sezer via lldb-commits
>  wrote:
>>
>> Author: sas
>> Date: Thu Aug 16 17:35:47 2018
>> New Revision: 339974
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=339974=rev
>> Log:
>> Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
>>
>> Summary:
>> .rela.debug_info relocations are being done via
>> ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
>> that iterates over the relocation type is only implemented for a few
>> different types and `assert(false)`es over the rest.
>>
>> Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations
>>
>> Reviewers: sas, xiaobai, javed.absar, espindola
>>
>> Reviewed By: sas
>>
>> Subscribers: emaste, arichardson, kristof.beyls
>>
>> Differential Revision: https://reviews.llvm.org/D50369
>>
>> Change by Nathan Lanza 
>>
> 
> This change should be unit testable, can you please give it a shot?
> Alternatively, you can probably use `lldb-test`, but maybe that
> requires some infrastructure to be written that's not there yet and I
> think it's not fair to ask you to write it.
> 
> --
> Davide
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 

lldb-test has the ability to dump the contents of object file sections.
The applied relocations should be reflected there.

pl
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r339974 - Add a relocation for R_AARCH64_ABS32 in ObjectFileELF

2018-08-20 Thread Davide Italiano via lldb-commits
On Fri, Aug 17, 2018 at 2:36 AM Stephane Sezer via lldb-commits
 wrote:
>
> Author: sas
> Date: Thu Aug 16 17:35:47 2018
> New Revision: 339974
>
> URL: http://llvm.org/viewvc/llvm-project?rev=339974=rev
> Log:
> Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
>
> Summary:
> .rela.debug_info relocations are being done via
> ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
> that iterates over the relocation type is only implemented for a few
> different types and `assert(false)`es over the rest.
>
> Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations
>
> Reviewers: sas, xiaobai, javed.absar, espindola
>
> Reviewed By: sas
>
> Subscribers: emaste, arichardson, kristof.beyls
>
> Differential Revision: https://reviews.llvm.org/D50369
>
> Change by Nathan Lanza 
>

This change should be unit testable, can you please give it a shot?
Alternatively, you can probably use `lldb-test`, but maybe that
requires some infrastructure to be written that's not there yet and I
think it's not fair to ask you to write it.

--
Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r339974 - Add a relocation for R_AARCH64_ABS32 in ObjectFileELF

2018-08-16 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Thu Aug 16 17:35:47 2018
New Revision: 339974

URL: http://llvm.org/viewvc/llvm-project?rev=339974=rev
Log:
Add a relocation for R_AARCH64_ABS32 in ObjectFileELF

Summary:
.rela.debug_info relocations are being done via
ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
that iterates over the relocation type is only implemented for a few
different types and `assert(false)`es over the rest.

Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations

Reviewers: sas, xiaobai, javed.absar, espindola

Reviewed By: sas

Subscribers: emaste, arichardson, kristof.beyls

Differential Revision: https://reviews.llvm.org/D50369

Change by Nathan Lanza 

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=339974=339973=339974=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Aug 16 
17:35:47 2018
@@ -2697,15 +2697,20 @@ unsigned ObjectFileELF::ApplyRelocations
 break;
   }
   case R_X86_64_32:
-  case R_X86_64_32S: {
+  case R_X86_64_32S:
+  case R_AARCH64_ABS32: {
 symbol = symtab->FindSymbolByID(reloc_symbol(rel));
 if (symbol) {
   addr_t value = symbol->GetAddressRef().GetFileAddress();
   value += ELFRelocation::RelocAddend32(rel);
-  assert(
-  (reloc_type(rel) == R_X86_64_32 && (value <= UINT32_MAX)) ||
+  if ((reloc_type(rel) == R_X86_64_32 && (value <= UINT32_MAX)) ||
   (reloc_type(rel) == R_X86_64_32S &&
-   ((int64_t)value <= INT32_MAX && (int64_t)value >= INT32_MIN)));
+   ((int64_t)value <= INT32_MAX && (int64_t)value >= INT32_MIN)) ||
+  (reloc_type(rel) == R_AARCH64_ABS32 && (value <= UINT32_MAX))) {
+Log *log =
+lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
+log->Printf("Failed to apply debug info relocations");
+  }
   uint32_t truncated_addr = (value & 0x);
   DataBufferSP _buffer_sp = debug_data.GetSharedDataBuffer();
   uint32_t *dst = reinterpret_cast(


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits