From Fedora Project Wiki
Description
This test case ensures that binutils
provides essential binary utilities and that binutils-gold
effectively serves as an alternative linker.
Setup
- Ensure you have a Fedora system.
- Install the related
binutils
packages:sudo dnf install binutils binutils-gold
.
How to test
- Open a terminal.
- Check the version of
binutils
:as --version
. - Use the
objdump
utility (frombinutils
) to display information about a binary. For example:objdump -d /bin/ls
. - Check the output to ensure information about the binary is displayed.
- Compile a simple C program using
gcc
. For instance, you can compile a basic "Hello, World!" program. - Link the program with the traditional GNU linker and note the link time.
- Link the program using the Gold linker by passing
-fuse-ld=gold
togcc
and compare the link time and memory usage.
Expected Results
- The
as
command should display the version information ofbinutils
. objdump
should provide details about the given binary without errors.- The C program should compile and link correctly using both the traditional GNU linker and the Gold linker.
- Gold linker should typically have faster link times and use less memory than the traditional linker.
Optional
For deeper testing:
- Test more complex programs with multiple dependencies to verify the efficiency of the Gold linker.
- Examine other utilities provided by
binutils
, such asnm
,strings
, andsize
. - Check how
binutils-gold
handles erroneous input or missing dependencies. - Benchmark the linking speed and memory usage of
binutils-gold
against the traditional linker on larger projects.