Blame SOURCES/tests/ld-alternative/runtest.sh

32f785
#!/bin/bash
32f785
32f785
# This test assumes lld is already installed.
32f785
32f785
set -ex
32f785
32f785
function verify_ld_bfd {
32f785
32f785
  # Verify that /usr/bin/ld points to ld.bfd.
32f785
  ls -l /etc/alternatives/ld | grep ld.bfd
32f785
32f785
  # Run ld and verify it invokes ld.bfd
32f785
  /usr/bin/ld --version | grep 'GNU ld'
32f785
}
32f785
32f785
32f785
# Verify ld.bfd is still the system linker when lld is installed
32f785
verify_ld_bfd
32f785
32f785
# Set lld as the system linker
32f785
update-alternatives --set ld /usr/bin/ld.lld
32f785
32f785
# Verify that /usr/bin/ld points to lld
32f785
ls -l /etc/alternatives/ld | grep ld.lld
32f785
32f785
# Run ld and verify it invokes lld
32f785
/usr/bin/ld --version | grep 'LLD'
32f785
32f785
# Uninstall lld and make sure the /usr/bin/ld is reset to ld.bfd
32f785
dnf -y remove --noautoremove lld
32f785
32f785
verify_ld_bfd