send2vinnie / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

ld.mcld fails with 'Too many open files' error #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Below is a shell script, that when executed produces 'Too many open files 
errors'

$cat a.sh
cat > 1.c << \!
int main()
{
  fn1();
  fn2();
}
!

cat > 2.c << \!
int fn1() {
  return 0;
}
!

cat > 3.c << \!
int fn2() {
  return 0;
}
!

cat > 4.c << \!
int fn3() {
  return 0;
}
!

cat > 5.c << \!
int fn4() {
  return 0;
}
!

gcc -c -m32 1.c 2.c 3.c 4.c 5.c
ulimit -n 10 && ld.mcld -r -march x86 1.o 2.o 3.o 4.o 5.o -o a

Output when the test is run :-

$sh -x a.sh
+ cat
+ cat
+ cat
+ cat
+ cat
+ gcc -c -m32 1.c 2.c 3.c 4.c 5.c
+ ulimit -n 10
+ ld.mcld -r -march x86 1.o 2.o 3.o 4.o 5.o -o a
Error: cannot open file `5.o': Too many open files.

With regular linker :-

$ulimit -n 10 && ld -r -m elf_i386 1.o 2.o 3.o 4.o 5.o -o a
$echo $?
0

What is the expected output? What do you see instead?

I expect the output to be linked properly.

What version of the product are you using? On what operating system?

The latest version (trunk)

Please provide any additional information below.

This problem is important for us, as there are command lines that have many 
inputs (archives and several individual files). 

Original issue reported on code.google.com by shanka...@gmail.com on 9 May 2013 at 7:37

GoogleCodeExporter commented 9 years ago
I see this too when trying to link a NetBSD kernel. I think the correct 
approach is to just close input files after mmapping them.

Original comment by joerg.sonnenberger@googlemail.com on 9 Aug 2013 at 1:54

GoogleCodeExporter commented 9 years ago

Original comment by pete.c...@gmail.com on 5 Sep 2013 at 3:41

GoogleCodeExporter commented 9 years ago
Should be fixed in revision 04c0a6a31c36.

Original comment by pete.c...@gmail.com on 22 Nov 2013 at 5:53