소스 검색

* ModulesLinkToLibc: Search for both bare and prefixed names of libc. When this function is invoked, import library names are not yet normalized and either one may be present. Failure to detect libc may end up in using wrong sysinit unit, this fortunately affects only i386-linux (other Linux targets aren't using Pascal sysinit units yet).

git-svn-id: trunk@22620 -
sergei 12 년 전
부모
커밋
0e8829e4e2
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      compiler/systems/t_linux.pas

+ 5 - 0
compiler/systems/t_linux.pas

@@ -230,6 +230,11 @@ begin
   hp:=tmodule(loaded_units.first);
   hp:=tmodule(loaded_units.first);
   while assigned(hp) do
   while assigned(hp) do
     begin
     begin
+      { Syntax "external 'c' name 'foo'" adds 'libc.so' to
+        linkothersharedlibs, while "$linklib c" adds just 'c'.
+        Therefore we must search for both names, this deserves a better fix. }
+      result:=hp.linkothersharedlibs.find(target_info.sharedClibprefix+'c'+target_info.sharedClibext);
+      if result then break;
       result:=hp.linkothersharedlibs.find('c');
       result:=hp.linkothersharedlibs.find('c');
       if result then break;
       if result then break;
       hp:=tmodule(hp.next);
       hp:=tmodule(hp.next);