This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
RE: Regarding "Inconsistency detected by ld.so" 32 Bit Elf
- From: Karthikeyan Shanmugam <karthikeyan24s at hotmail dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Carlos O'Donell <carlos at systemhalted dot org>, "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Wed, 15 May 2013 00:51:32 +0530
- Subject: RE: Regarding "Inconsistency detected by ld.so" 32 Bit Elf
- References: <BLU166-W4365C811BA9EAD5EFFDFDACFB90 at phx dot gbl>,<CAE2sS1jvd97vkPVm+mG=7BBfXX6yYE7POaR75kufrETo40wZkw at mail dot gmail dot com>,<BLU166-W16249AA58CE03F785B384DCFBA0 at phx dot gbl> <BLU166-W3756E8E882E23498AF7DF8CFBA0 at phx dot gbl>,<51896432 dot 9010104 at redhat dot com> <BLU166-W44B5F09CC4E3CFCAE7567CCFBB0 at phx dot gbl>,<518AAB2A dot 7070104 at redhat dot com> <BLU166-W52EE351DA2F5FBA91E2223CFA40 at phx dot gbl>,<518BEDA4 dot 7080405 at redhat dot com> <BLU166-W488B0744F671177BE5410CFA50 at phx dot gbl>,<519120EA dot 6080907 at redhat dot com>
First,Thanks a bunch Carlos for detailed explanation on ELF load segments.
>>>>> I know that QEMU has to do something similar. There are probably so
>>>>> few applications that need to do this that there is no good accepted
>>>>> standard way to accomplish this.
>>
>> Yes. I've checked QEMU code and linker script. They are modifying
>> only the executable start address and Text segment in the custom
>> linker script but no new/custom section which reserves VMA space .
>
> Have you tried doing something similar?
Those custom changes are already live in my linker script which is working as expected (placing an executable in desired location). My changes are little bit more which adds FAKE segment in linker script. There was a similar query I noticed in other sourcewave forum few years back (resolved one). Not sure I can provide link here or not.
>> Here, the first load segment base address is non-zero, so just
>> curious to know whether prelink has some mechanism to detect and
>> relocate only these libraries?
>
> Why does prelink have to detect anything? It just reads the ELF file
> and knows exactly the layout of the library.
I agree.. Just wondering in my case, I don't want all the system libraries to be prelink'd instead need to perform reloc-only for specific libraries. To achieve this I'm forced to use -rpath and clone the system library then relocate the base address. So, thought if prelink has any internal option to detect such application requirements.
>> Can you please provide me some pointers or docs related to this ?
>> More interested to understand how Kernel decides on ELF placement
>> from code perspective.
>
> There are no docs, you need to read the source for mmap :-)
Thanks. Due to the PAX code, most of the time messed up with executable load flow :)
KS