github.com/jlowellwofford/u-root@v1.0.0/pkg/ldd/ldso_linux.go (about)

     1  // Copyright 2017-2018 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ldd
     6  
     7  import (
     8  	"fmt"
     9  	"path/filepath"
    10  )
    11  
    12  const ldso = "/lib*/ld-linux-*.so.*"
    13  
    14  func LdSo() (string, error) {
    15  	n, err := filepath.Glob(ldso)
    16  	if err != nil {
    17  		return "", err
    18  	}
    19  	if len(n) == 0 {
    20  		return "", fmt.Errorf("No ld.so matches %v", ldso)
    21  	}
    22  	return n[0], nil
    23  }