[lld] [LLD] dtNeeded name should consistent with soNames (PR #72857)
Longsheng Mou via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 22:18:06 PST 2023
CoTinker wrote:
> I suspect that you have an incorrect use case, but the case is not clearly described and I cannot verify. This inconsistency fault is likely at the user side when a shared object does not have `DT_SONAME` (https://maskray.me/blog/2020-11-15-explain-gnu-linker-options#sonamename)
>
> FYI I place all needed files in a directory and run `cd dir; mkreproduce . > /tmp/rep.sh` to create `cat <<eof` and `echo` instructions that other people can easily reproduce. (e.g. https://maskray.me/blog/2020-11-26-all-about-symbol-versioning#version-script is an example using the script to prepare for input files)
>
> ```
> #!/bin/zsh
> dry_run=
> if [[ $1 == --dry-run ]]; then dry_run=1; shift; fi
>
> f() {
> for f in $1/*(ND.^x); do
> [[ ${f##*/} =~ '^\.' ]] && continue
> if [[ -n $dry_run ]]; then
> echo $f
> elif [[ $(wc -l < $f) == 1 ]]; then
> echo "echo '$(<$f)' > $f"
> else
> if [[ ${f##*/} == Makefile ]]; then
> printf '%s\n' "sed 's/^ /\\t/' > $f <<'eof'"
> else
> echo "cat > $f <<'eof'"
> fi
> cat $f
> echo eof
> fi
> done
> for d in $1/*(ND/); do
> [[ $d =~ '^\.' ]] && continue
> echo mkdir -p $d
> f $d
> done
> }
>
> f ${1:-.}
> ```
>
> ```
> clang case/use.c -o exe/libuse.so -lhave -Lexe --shared -fPIC
> ```
>
> The `-o libuse.so` instruction does not mention how you switched the directory, so the example is difficult to follow.
Thank you, the core problem is probably shared object does not have DT_SONAME.
https://github.com/llvm/llvm-project/pull/72857
More information about the llvm-commits
mailing list