Hi folks,

I am having a little bit of trouble with ar and objcopy.
Unsure if I am doing something that I should not expect the tools to do, or encountering a bug.

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

gives

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:

...

SYMBOL TABLE:

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.


Is this a bug?


This is actually part of a bigger effort on another issue of symbol collision at link time:
https://github.com/rust-lang/compiler-builtins/issues/345

In short, both Rust and C export "builtins" for basic operations, e.g. IEEE 754 float operations here, which collide when trying to statically link the outputs together for an embedded target. So I am trying to localize all the symbols in the .a before linking, such that each of Rust and C will use their own impls of the builtins, to avoid collision. (I assume there is probably some more-correct way of resolving this collision, so any input here would also be great!)


Thanks,
Andrew

Reply via email to