[PATCH] gprofng: a new GNU profiler

Vladimir Mezentsev vladimir.mezentsev@oracle.com
Mon Aug 16 20:06:31 GMT 2021



On 8/13/21 9:25 AM, Joseph Myers wrote:
> On Thu, 12 Aug 2021, Vladimir Mezentsev via Binutils wrote:
>
>
>>> For x86_64/i686, binutils supports both 32-bit and 64-bit code generation
>>> (by default for x86_64; for i686 if --enable-64-bit-bfd).  Can gprofng
>>> support that, i.e. x86_64, or i686 --enable-64-bit-bfd, gprofng support
>>> processing data collected on the relevant architecture, and support native
>>> collection for both 32-bit and 64-bit binaries if built as native?
>> For x86_64, I build twice. One is  for 64-bit gprofng. The other is for 32-bit
>> libraries only:
>> 1. --prefix=INSTALL_DIR --enable-shared
>> 2. --prefix=INSTALL_DIR --enable-shared CFLAGS=-m32 CXXFLAGS=-m32
>> CCFLAGS=-m32 --target=i686-pc-linux-gnu --libdir=INSTAL_DIR/lib32
>>
>> Is it correct ?
>> How do you build binutils-gdb for x86_64/i686?
> A single 64-bit GDB binary can debug both 32-bit and 64-bit (and x32)
> inferiors (a 32-bit GDB binary can't debug 64-bit inferiors, however, for
> lack of appropriate kernel interfaces in the 32-bit syscall interface),
> and a single set of binutils binaries (either 32-bit or 64-bit) can
> support assembling / linking both 32-bit and 64-bit code (with appropriate
> options passed to e.g. the assembler to tell it whether to generate 32-bit
> or 64-bit output).  It's clearly preferable to support that if possible.
> Is it practical to support that in gprofng, or does it depend on kernel
> interfaces that aren't available for the case of a 64-bit process
> operating on a 32-bit one, or on loading libraries in the profiled
> process's address space that thus need to be built separately for each
> ABI?
>

We use LD_PRELOAD to load our library in the profiled process's address 
space.
As I understand, we can not build together our 32-bit and 64-bit libraries.
We should build separately for each ABI.
If it is correct, how should I configure my build for the 32-bit ABI on 
x86_64 ?
Is it correct :
    --enable-shared CFLAGS=-m32 CXXFLAGS=-m32 CCFLAGS=-m32 
--target=i686-pc-linux-gnu --prefix=INSTALL_DIR --libdir=INSTAL_DIR/lib32


Thank you,
-Vladimir


More information about the Binutils mailing list