[PATCH]mips: ldso: dlopen with flag RTLD_NOW should look up the symbols

Andrew Bennett Andrew.Bennett at imgtec.com
Fri Feb 20 12:59:46 UTC 2015


> Reason:
> MIPS ELF strategy is so different from other architectures like x86 and arm.
> When fPIC enabled in x86 and arm, ".rel.plt" section is generated after
> ".rel.dyn" section, and the dependency of the library (like the function and
> object) . But MIPS only generates ".rel.dyn" section for the library when
> fPIC, and ".rel.dyn" section can only be generated in non-PIC executable.
> This leads to a bug which other architectures will not have.
> 
> Description:
> If you dlopen a library, uclibc only check the symbols defined in ".rel.dyn"
> section. And ".rel.dyn" section has no outer dependency, most flags have the
> type "R_MIPS_REL32". Only ".rel.plt" section generates call to
> R_MIPS_JUMP_SLOT and R_MIPS_COPY.
> In my environment, I almost see the cplusplus virtual functions in ".rel.dyn".
> 
> Bug Demo:
> use mipsel-linux-readelf -aW libxx.so to view the dependency.
> 
> Patch:
> MIPS: Scan the symtab for the dependency of the library to avoid runtime empty
> function pointer.
> The dependency = SHN_UNDEF && STB_GLOBAL && (STT_FUNC || STT_OBJECT)

Hi Jean,

I am a little unclear why this patch is required.  Could you provide me with a
more detailed explanation, and a testcase/example showing the problem?

Many thanks,


Andrew


More information about the uClibc mailing list