Skip to content

Commit

Permalink
fix linking with mold on 32bit archs; rel 6
Browse files Browse the repository at this point in the history
for some reason gcc assumes all linkers should search for libraries in
/lib and /usr/lib and deliberately skips them when constructing linker
command line. this assumption does not apply to mold though and does not
seem reasonable in general hence drop this logic and pass unfiltered
LIBRARY_PATH to linker

see:
rui314/mold#358
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104707
  • Loading branch information
jpalus committed Apr 19, 2022
1 parent eefabf0 commit a8e40d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 20 additions & 0 deletions all-library-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- gcc-11.2.0/gcc/gcc.c.orig 2022-04-18 15:40:02.650553155 +0200
+++ gcc-11.2.0/gcc/gcc.c 2022-04-19 09:31:21.340818868 +0200
@@ -7817,17 +7817,6 @@
*cp++ = '.';
*cp = '\0';

- /* Exclude directories that the linker is known to search. */
- if (linker
- && IS_DIR_SEPARATOR (path[0])
- && ((cp - path == 6
- && filename_ncmp (path + 1, "lib", 3) == 0)
- || (cp - path == 10
- && filename_ncmp (path + 1, "usr", 3) == 0
- && IS_DIR_SEPARATOR (path[4])
- && filename_ncmp (path + 5, "lib", 3) == 0)))
- return 0;
-
return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
}

4 changes: 3 additions & 1 deletion gcc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Summary(pl.UTF-8): Kolekcja kompilatorów GNU: kompilator C i pliki współdziel
Summary(pt_BR.UTF-8): Coleção dos compiladores GNU: o compilador C e arquivos compartilhados
Name: gcc
Version: %{major_ver}.%{minor_ver}
Release: 5
Release: 6
Epoch: 6
License: GPL v3+
Group: Development/Languages
Expand All @@ -121,6 +121,7 @@ Source4: branch.sh
Patch100: %{name}-branch.diff
# Patch100-md5: e4e0ccce73627de0bf6564d11c54b603
Patch0: %{name}-info.patch
Patch1: all-library-paths.patch
Patch2: %{name}-nodebug.patch
Patch3: %{name}-ada-link.patch
Patch4: %{name}-ada-x32.patch
Expand Down Expand Up @@ -2574,6 +2575,7 @@ więc wtyczki muszą być przebudowywane przy każdej aktualizacji GCC.
%setup -q
%patch100 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
Expand Down

0 comments on commit a8e40d1

Please sign in to comment.