[PATCH] Fix ld/x86: reduce testsuite dependency on system object files

Jan Beulich jbeulich@suse.com
Thu Dec 7 07:17:18 GMT 2023


On 06.12.2023 18:25, H.J. Lu wrote:
> On Sun, Dec 3, 2023 at 11:27 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 01.12.2023 18:21, H.J. Lu wrote:
>>> commit eab996435fe65a421541f59557c5f1fd427573a3
>>> Author: Jan Beulich <jbeulich@suse.com>
>>> Date:   Tue Nov 7 13:58:32 2023 +0100
>>>
>>>     ld/x86: reduce testsuite dependency on system object files
>>>
>>> changed some C compiler tests to assembler/linker tests which introduced
>>> 2 problems:
>>>
>>> 1. It broke x32 binutils tests since --64 was passed to assembler, but
>>> -m elf_x86_64 wasn't passed to linker.
>>
>> What kind of configuration and/or testing would I have needed to do to see
>> those failures? Quite obviously I wouldn't have committed (nor even
>> submitted) this change with known failing tests.
> 
> You need an x32 toolchain, like
> 
> [hjl@gnu-cfl-3 binutils-x32]$ file /usr/localx32/bin/ld
> /usr/localx32/bin/ld: ELF 32-bit LSB executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
> BuildID[sha1]=5f1a971f969147c466cac7f7a2d0ad89899e06b9, for GNU/Linux
> 3.4.0, stripped
> [hjl@gnu-cfl-3 binutils-x32]$ file /usr/gcc-11.2.1-mx32/bin/gcc
> /usr/gcc-11.2.1-mx32/bin/gcc: ELF 32-bit LSB executable, x86-64,
> version 1 (SYSV), dynamically linked, interpreter
> /libx32/ld-linux-x32.so.2,
> BuildID[sha1]=c0ee7a727c32f7933dbfb433d59ffdf99295030c, for GNU/Linux
> 3.4.0, stripped
> [hjl@gnu-cfl-3 binutils-x32]$
> 
>>> 2. -nostdlib was passed to C compiler driver to exclude standard run-time
>>> files which should be avoided with -r option for linker tests.
>>
>> Already before my change -nostdlib was used together with -r.
> 
> -nostdlib is a GCC driver option.  It is used like
> 
> # gcc -r -nostdlib ....

And what use has the option with -r?

> But it is wrong to do
> 
> $ ld -r -nostdlib

Well, as per Fangrui, not so much wrong than (again) meaningless.

Jan


More information about the Binutils mailing list