-
Vivek Das Mohapatra authored
We used to set the elf class (32 vs 64) and machine (eg EM_X86_64) from the first DSO we found in the path, but that was only ever coincidentally corect - if we had found a foreign arch (eg i386 or x32 from an x86_64 binary) then our whole link chain would have been pulled from the wrong architacture. Instead we should pick a DSO which has _already been successfully loaded_ and use that to pick only matching DSOs.
Vivek Das Mohapatra authoredWe used to set the elf class (32 vs 64) and machine (eg EM_X86_64) from the first DSO we found in the path, but that was only ever coincidentally corect - if we had found a foreign arch (eg i386 or x32 from an x86_64 binary) then our whole link chain would have been pulled from the wrong architacture. Instead we should pick a DSO which has _already been successfully loaded_ and use that to pick only matching DSOs.