Search code examples
gccobjcopy

Problem while using objcopy with "thin archive" file


Please use following shell commands to reproduce the problem:

# create subdirectory
mkdir subdir

# create source files with dummy functions
echo 'void func1(){}' > file1.c
echo 'void func2(){}' > ./subdir/file2.c

# compiling sources into object files
gcc -c file1.c -o file1.o
gcc -c ./subdir/file2.c -o ./subdir/file2.o

# creating "thin archive" file from object files
ar crT out.a file1.o ./subdir/file2.o

# running objcopy, which leads to an error
objcopy out.a out_copy.a

As a result, following error occurs:

objcopy:st0AENRL/subdir/file2.o: No such file or directory

P.S. Problem with objcopy occurs when "thin" archive is composed of object files from subdirectories.

Does anybody know if such objcopy's behavior is ok?


Solution

  • This is really a bug. It was reported here. Support of thin archives was temporary disabled.