I am trying to localize some symbols in objects inside an archive.
Ultimately, it seems like the tools are failing because the .a appears to contain an object with the name "bin/thumbv7em-none-eabihf.o".
This all started from trying:
arm-none-eabi-objcopy --localize-hidden librustlib.a
So operations like:
arm-none-eabi-objcopy -L __aeabi_dcmpgt librustlib.a
result in the error:
arm-none-eabi-objcopy: stsJ3ObR/bin/thumbv7em-none-eabihf.o: No such file or directory
with apparently no change to the archive file.
The symbol is definitely in there:
arm-none-eabi-objdump -x librustlib.a
compiler_builtins-2ff80b98fa64b741.compiler_builtins.6207f1bb-cgu.122.rcgu.o: file format elf32-littlearm
rw-r--r-- 0/0 10176 Dec 31 16:00 1969 compiler_builtins-2ff80b98fa64b741.compiler_builtins.6207f1bb-cgu.122.rcgu.o
architecture: armv7e-m, flags 0x00000011:
00000000 l df *ABS* 00000000 compiler_builtins.6207f1bb-cgu.122
00000000 l d .text.__aeabi_dcmpgt 00000000 .text.__aeabi_dcmpgt
00000000 g F .text.__aeabi_dcmpgt 00000078 .hidden __aeabi_dcmpgt
So the symbol is there, flagged as a Function, .hidden, but still global.
Checking the contents of the archive:
arm-none-eabi-ar tv librustlib.a | grep thumb
it does appear that something is there:
rw-r--r-- 0/0 22732 Dec 31 16:00 1969 bin/thumbv7em-none-eabihf.o
When I try to extract everything in the archive:
arm-none-eabi-ar x librustlib.a
it extracts all objects up to that problem object with the '/' in the name, but none after it.
This appears to originate from here:
As far as I can tell, there is no defined behavior for how archive files with a path containing a directory should behavior with the ar utility.
afaik, `fopen()` has no facility for creating directories.
Notably, if I do `mkdir bin` first, then the observed "No such file or directory" error will NOT be hit when using ar to extract, as now the pathname becomes valid.
However: the issue remains with objcopy, since it apparently uses a temporary directory when doing an operation like `--localize-hidden`.
Also of note:
This appears to arise due to this archive file being created with `llvm-ar`, which does explicitely allow slashes in path name:
Using llvm-objcopy yields different behavior: the --localize-hidden operation succeeds without issue, despite the pathname containing a `/`
(In reply to Andrew Pullin from comment #1)
> As far as I can tell, there is no defined behavior for how archive files
> with a path containing a directory should behavior with the ar utility.