|ARM Technical Support Knowledge Articles|
Applies to: ARM Developer Suite (ADS)
Both ADS and RVCT are available on more than one platform (typically Windows, Linux and Solaris).
It is ARM's intention that, given the same source and build command, all platforms should produce the same binary file with one or two legitimate exceptions such as predefined macros like __FILE__ and __TIME__
In ADS1.2 there is a situation in which builds on different platforms can sometimes differ; when the linker brings in the ARM libraries, it first obtains a directory listing of the library directory to check required libraries are available. Different operating systems can return the list of files in a different order. This changes the order in which the libraries are loaded and alters the placement of objects and veneers in the final image. Images from different platforms will still be functionally identical.
The workaround is to explicitly list the required ARM libraries on the link line. This will ensure the order is identical for both platforms.
To determine which libraries the linker is using, temporarily link with the -verbose switch (also use -errors to redirect stderr to a file) i.e.
armlink -verbose -errors stderr.txt ...
Within the stderr.txt file (which will probably be very long) look for lines resembling;
Selecting library C:Program FilesARMADSv1_2LIBarmlibc_a__un.l.
Selecting library C:Program FilesARMADSv1_2LIBarmlibf_a_p.l.
Selecting library C:Program FilesARMADSv1_2LIBarmlibm_a_pu.l.
This will tell you which libraries to list on the link line. For information on the library naming convention see section 4.15 of the ADS 1.2 Compiler and Libraries Guide.
Then to disable the possible inclusion of libraries that you have accidentally missed, or that get added/changed due to code changes, add -noscanlib to the linker command line e.g.
armlink -noscanlib "C:Program FilesARMADSv1_2Libarmlibc_a__un.l" "C:Program FilesARMADSv1_2LIBarmlibf_a_p.l" "C:Program FilesARMADSv1_2LIBarmlibm_a_pu.l"
The library path can be used to make the command line shorted and tidier, e.g.
armlink -noscanlib "%ARMLIB%armlibc_a__un.l" "%ARMLIB%armlibf_a_p.l" "%ARMLIB%armlibm_a_pu.l"
In RVCT2.0.1 and onwards the linker sorts the libraries internally into a known order which means it is not necessary (nor advisable) to list the libraries explicitly.
In addition to this some of the fixes in ADS1.2 patches are relevant to ensuring that different platforms build identical images so we strongly recommend upgrading to at least build 842 and preferably build 848. See the ADS1.2 download page for links to these patches.
Beware that using a wildcard like *.o to specify objects or libraries could cause a similar problem if operating systems return the list of matching objects in different orders.
To check that builds are equivalent it is best to convert the image to a binary file and compare these, otherwise expected differences in debug data, such as pathnames to source files, can cause confusion. To generate a binary for comparison use
fromelf -bin -o output.bin input.axf
Article last edited on: 2008-09-09 15:47:46
Did you find this article helpful? Yes No
How can we improve this article?