Using GNU AS from a selfmade binutils v2.35.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Masahiro and ClangBuiltLinux folks,

I am trying to use binaries from GNU/binutils v2.35.2 for my
Linux-kernel builds.

Background is I am doing some testing for BTF + pahole with GCC-10 and LLVM-12.

I tried several strategies.

[ STRATEGY #1 - Use a-local-binutils.conf LDCONFIG ]

[ /etc/ld.so.conf.d/a-local-binutils.conf ]

# Selfmade GNU/binutils lib configuration
/opt/binutils/lib
- EOT -

sudo ldconfig
sudo ldconfig -v -p
...shows me above lib path is in the ldconfig-cache.

In my build-script I additionally add:

BINUTILS_BIN_PATH="/opt/binutils/bin"
if [ -d ${BINUTILS_BIN_PATH} ]; then
    export PATH="${BINUTILS_BIN_PATH}:${PATH}"
fi

That's NOT including ld.bfd from /opt/binutils/bin - not including nm,
ar, strip etc.

NOTE: Symlink: lrwxrwxrwx 1 root   root     15  5. Feb 11:10
/opt/binutils -> binutils-2.35.2

[ STRATEGY #2 - Use LD_LIBRARY_PATH ]

>From my build-script:

BINUTILS_BIN_PATH="/opt/binutils/bin"
BINUTILS_LIB_PATH="/opt/binutils/lib"
if [ -d ${BINUTILS_BIN_PATH} ] && [ -d ${BINUTILS_LIB_PATH} ]; then
   export PATH="${BINUTILS_BIN_PATH}:${PATH}"
   export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BINUTILS_LIB_PATH}"
fi

That's not working either.
New PATH and LD_LIBRARY_PATH are set in the user's environment variables.

[ STRATEGY #3 - Use which to get full path to binary ]

### GCC version settings
GCC_MAJOR_VER="10"

### Compiler options
CC_FOR_BUILD="clang"
CXX_FOR_BUILD="clang++"

### Linker options
##LD_FOR_BUILD="ld.bfd"
LD_FOR_BUILD=$(which ld.bfd)

### GNU tools options
# NOTE: Selfmade GNU AS v2.35.2 needs to be symlinked in /usr/bin directory
# XXX: Symlink: /usr/bin/as -> /opt/binutils-2.35.2/bin/as
HOSTAR_FOR_BUILD=$(which ar)
AR_FOR_BUILD=$(which ar)
NM_FOR_BUILD=$(which nm)
STRIP_FOR_BUILD=$(which strip)
OBJCOPY_FOR_BUILD=$(which objcopy)
OBJDUMP_FOR_BUILD=$(which objdump)
READELF_FOR_BUILD=$(which readelf)
GNU_TOOLS_OPTS="HOSTCC=${CC_FOR_BUILD} HOSTCXX=${CXX_FOR_BUILD}
HOSTLD=${LD_FOR_BUILD} HOSTAR=${HOSTAR_FOR_BUILD}"
GNU_TOOLS_OPTS="$GNU_TOOLS_OPTS CC=${CC_FOR_BUILD} LD=${LD_FOR_BUILD}
AR=${AR_FOR_BUILD} NM=${NM_FOR_BUILD} STRIP=${STRIP_FOR_BUILD}"
GNU_TOOLS_OPTS="$GNU_TOOLS_OPTS OBJCOPY=${OBJCOPY_FOR_BUILD}
OBJDUMP=${OBJDUMP_FOR_BUILD} READELF=${READELF_FOR_BUILD}"

That works - means passes all binaries from GNU binutils v2.35.2 to my
make-line.

Please NOTE that I had to symlink GNU AS v2.35.2 as I saw too late I
was using Debian's GNU AS v2.35.1 within my last builds.

AFAICS there is no more AS= assignment in the top-level Makefile.
How can I say: "Please use a different ASsembler?"

[ LDD ]

When I inspect with ldd (here: GNU AS v2.35.2):

# ldd /opt/binutils/bin/as
       linux-vdso.so.1 (0x00007ffc7f4d6000)
       libopcodes-2.35.2.so =>
/opt/binutils-2.35.2/lib/libopcodes-2.35.2.so (0x00007f11f3bcc000)
       libbfd-2.35.2.so => /opt/binutils-2.35.2/lib/libbfd-2.35.2.so
(0x00007f11f3a8b000)
       libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f11f3a44000)
       libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f11f387f000)
       libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f11f3879000)
       /lib64/ld-linux-x86-64.so.2 (0x00007f11f3de3000)

So GNU AS v2.35.2 is loading from the correct places.

Is the symlink in /opt directory a problem?
binutils -> binutils-2.35.2

Can someone comment and give me a hint?

Thanks in advance.

Regards,
- Sedat -



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux