Skip to content

Commit

Permalink
rtdl: prefer RUNPATH over RPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
ArsenArsen committed Aug 19, 2023
1 parent 4aa7399 commit ff3c0eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions options/rtdl/generic/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ void ObjectRepository::_parseDynamic(SharedObject *object) {
// Fix up these offsets to addresses after the loop, since the
// addresses depend on the value of DT_STRTAB.
frg::optional<ptrdiff_t> runpath_offset;
/* If true, ignore the RPATH. */
bool runpath_found = false;
frg::optional<ptrdiff_t> soname_offset;

for(size_t i = 0; object->dynamic[i].d_tag != DT_NULL; i++) {
Expand Down Expand Up @@ -637,12 +639,13 @@ void ObjectRepository::_parseDynamic(SharedObject *object) {
<< frg::endlog;
break;
case DT_RPATH:
if(!rpathWarned) {
rpathWarned = true;
mlibc::infoLogger() << "\e[31mrtdl: RUNPATH not preferred over RPATH properly\e[39m" << frg::endlog;
if (runpath_found) {
/* Ignore RPATH if RUNPATH was present. */
break;
}
[[fallthrough]];
case DT_RUNPATH:
runpath_found = dynamic->d_tag == DT_RUNPATH;
runpath_offset = dynamic->d_un.d_val;
break;
case DT_INIT:
Expand Down

0 comments on commit ff3c0eb

Please sign in to comment.