[review] [RFC] Support $ORIGIN in DW_AT_comp_dir

matt rice (Code Review)
2019-10-28T22:03:25Z

matt rice has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/402
......................................................................

Patch Set 1:

regarding your open questions, it seems according to
https://www.sco.com/developers/gabi/latest/ch5.dynamic.html#substitution

valid names (like 'ORIGIN') match as:

name := [_a-zA-Z0-9]*

quoting:
If a dollar sign is not immediately followed by a name or a brace-enclosed name, the behavior of the dynamic linker is unspecified.
---

so $$ORIGIN is unspecified,

quoting:
Moreover, the pathname will contain no symbolic links or use of . or .. components.
---

however I believe this is refering to the path _after_ the substitution sequence rather than before.

If the '/' occurs before the substitution sequence, I believe that the following may(?) apply, in which case ./$ORIGIN is treated as a directory named literally $ORIGIN in the current directory?

https://www.sco.com/developers/gabi/latest/ch5.dynamic.html#shobj_dependencies

quoting:
If a shared object name has one or more slash (/) characters anywhere in the name, such as /usr/lib/lib2 or directory/file, the dynamic linker uses that string directly as the path name. If the name has no slashes, such as lib1, three facilities specify shared object path
---

Note the enclosed link includes another valid name not matched by the patch, in particular:
${ORIGIN}

--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I5cd12d8c37c19fd2e9229b474d37f72185e41178
Gerrit-Change-Number: 402
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-CC: matt rice <ratmice@gmail.com>
Gerrit-Comment-Date: Mon, 28 Oct 2019 22:03:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment