Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

gcc-4.8: add library paths reported by system linker #691

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gcc-4.8/post-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ else
# ... yada yada ... -isystem ${INCDIR}
sed -i ':a;N;$!ba;s|\(*cpp:\n[^\n]*\)|\1 -isystem '${INCDIR}'|g' "${SPECS_FILE}"
done

#
# Linux Portability Issue #2.5: linker also needs to find the rest of libc (i.e. libc.so in addition to crtXXX.o)
#
for library_path in $(/usr/bin/ld --verbose | grep SEARCH_DIR | sed -r 's/SEARCH_DIR\("=?([^"]*)"\);/ \1/g'); do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the full path to the system /usr/bin/ld instead of ld is a good idea. (It avoids problems if the user has a custom install of binutils.) While you're at it, can you also fix the call to ld on line 49, above?

sed -i ':a;N;$!ba;s|\(*link_libgcc:\n[^\n]*\)|\1 -L'${library_path}'|g' "${SPECS_FILE}"
done
fi

## TEST: Here we verify that gcc can build a simple "Hello world" program for both C and C++.
Expand Down