public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* compiling glibc using -fasynchronous-unwind-tables for arm
@ 2023-03-09 10:04 Abhijit Ray Chaudhury
  2023-03-14  9:18 ` Abhijit Ray Chaudhury
  2023-03-14 18:47 ` Adhemerval Zanella Netto
  0 siblings, 2 replies; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-09 10:04 UTC (permalink / raw)
  To: libc-help

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Hi ,

I am trying to compile glibc-2.25 with -fasynchronous-unwind-tables flag
for correctly generating backtrace . But during configure, it conflicts
with -fno-unwind-tables passed by sysdeps/arm/preconfigure and generates
link error during conftest.

My gcc does not enable -fasynchronous-unwind-tables by default. How do I
compile entire libc using unwind-tables ?

Thanks in Advance,
-Abhijit

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-09 10:04 compiling glibc using -fasynchronous-unwind-tables for arm Abhijit Ray Chaudhury
@ 2023-03-14  9:18 ` Abhijit Ray Chaudhury
  2023-03-14 18:47 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-14  9:18 UTC (permalink / raw)
  To: libc-help

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Hi.

Has anybody compiled glibc with -fasynchronous-unwind-tables for arm
platform?

Thanking You,

-Abhijit

On Thu, 9 Mar, 2023, 3:34 pm Abhijit Ray Chaudhury, <
abhijit.ray.chaudhury@gmail.com> wrote:

> Hi ,
>
> I am trying to compile glibc-2.25 with -fasynchronous-unwind-tables flag
> for correctly generating backtrace . But during configure, it conflicts
> with -fno-unwind-tables passed by sysdeps/arm/preconfigure and generates
> link error during conftest.
>
> My gcc does not enable -fasynchronous-unwind-tables by default. How do I
> compile entire libc using unwind-tables ?
>
> Thanks in Advance,
> -Abhijit
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-09 10:04 compiling glibc using -fasynchronous-unwind-tables for arm Abhijit Ray Chaudhury
  2023-03-14  9:18 ` Abhijit Ray Chaudhury
@ 2023-03-14 18:47 ` Adhemerval Zanella Netto
  2023-03-15  8:36   ` Abhijit Ray Chaudhury
  1 sibling, 1 reply; 12+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-14 18:47 UTC (permalink / raw)
  To: Abhijit Ray Chaudhury, libc-help



On 09/03/23 07:04, Abhijit Ray Chaudhury via Libc-help wrote:
> Hi ,
> 
> I am trying to compile glibc-2.25 with -fasynchronous-unwind-tables flag
> for correctly generating backtrace . But during configure, it conflicts
> with -fno-unwind-tables passed by sysdeps/arm/preconfigure and generates
> link error during conftest.
> 
> My gcc does not enable -fasynchronous-unwind-tables by default. How do I
> compile entire libc using unwind-tables ?
> 
> Thanks in Advance,
> -Abhijit


I don't see any build issue on master with:

CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables" \
CXX="arm-glibc-linux-gnueabihf-g++ -fasynchronous-unwind-tables" \
configure --prefix=/usr

With gcc 11.3.1.  I am not sure about 2.25, this is a quite old version; but 
I also don't see anything on git history that might affect it.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-14 18:47 ` Adhemerval Zanella Netto
@ 2023-03-15  8:36   ` Abhijit Ray Chaudhury
  2023-03-15 12:59     ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-15  8:36 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: libc-help

[-- Attachment #1: Type: text/plain, Size: 3482 bytes --]

HI Adhemerval,

Thanks a lot for the response.

If you look into the arm preconfgure.ac , (
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/preconfigure.ac;h=a70738526311c0b0ed21b175eec0bee90c850025;hb=9e2ff880f3cbc0b4ec8505ad2ce4a1c92d7f6d56)
, you would notice :

 CFLAGS="$CFLAGS -fno-unwind-tables" or -fno-unwind-tables is getting added
to the cflags during configure.

This is conflicting with -fasynchronous-unwind-tables that I passed. And I
am getting following error :
=======================================================================================

arm-linux-gnueabihf-gcc  -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard
 --sysroot=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot
 -isystem/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include
-I/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot/usr/include
-O2 -pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0=/usr/src/debug/glibc/linaro-2.25-r0
-fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot=
-fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot-native=
* -fasynchronous-unwind-tables -fno-unwind-tables *
-L/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib
-Wl,-rpath-link,/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib
-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -Wl,-z,relro,-z,now
-fno-stack-protector -o conftest
               conftest.c -static -nostartfiles -nostdlib
               1>&5
/tmp/ccbJ1zoJ.o:(.ARM.exidx+0x0): undefined reference to
`__aeabi_unwind_cpp_pr0'
/tmp/ccbJ1zoJ.o:(.ARM.exidx.text.startup+0x0): undefined reference to
`__aeabi_unwind_cpp_pr0'
/tmp/ccbJ1zoJ.o:(.ARM.exidx.text.exit+0x0): undefined reference to
`__aeabi_unwind_cpp_pr0'
collect2: error: ld returned 1 exit status
configure:5687: $? = 1
configure:5707: error: missing __attribute__ ((constructor)) support??
======================================================================================

I am interested to know your config.log after you built. Can you please
share ?

Thanks in Advance,
-Abhijit

On Wed, Mar 15, 2023 at 12:17 AM Adhemerval Zanella Netto <
adhemerval.zanella@linaro.org> wrote:

>
>
> On 09/03/23 07:04, Abhijit Ray Chaudhury via Libc-help wrote:
> > Hi ,
> >
> > I am trying to compile glibc-2.25 with -fasynchronous-unwind-tables flag
> > for correctly generating backtrace . But during configure, it conflicts
> > with -fno-unwind-tables passed by sysdeps/arm/preconfigure and generates
> > link error during conftest.
> >
> > My gcc does not enable -fasynchronous-unwind-tables by default. How do I
> > compile entire libc using unwind-tables ?
> >
> > Thanks in Advance,
> > -Abhijit
>
>
> I don't see any build issue on master with:
>
> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables" \
> CXX="arm-glibc-linux-gnueabihf-g++ -fasynchronous-unwind-tables" \
> configure --prefix=/usr
>
> With gcc 11.3.1.  I am not sure about 2.25, this is a quite old version;
> but
> I also don't see anything on git history that might affect it.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-15  8:36   ` Abhijit Ray Chaudhury
@ 2023-03-15 12:59     ` Adhemerval Zanella Netto
  2023-03-15 14:20       ` Florian Weimer
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-15 12:59 UTC (permalink / raw)
  To: Abhijit Ray Chaudhury; +Cc: libc-help



On 15/03/23 05:36, Abhijit Ray Chaudhury wrote:
> HI Adhemerval,
> 
> Thanks a lot for the response.
> 
> If you look into the arm preconfgure.ac <http://preconfgure.ac> , (https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/preconfigure.ac;h=a70738526311c0b0ed21b175eec0bee90c850025;hb=9e2ff880f3cbc0b4ec8505ad2ce4a1c92d7f6d56 <https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/preconfigure.ac;h=a70738526311c0b0ed21b175eec0bee90c850025;hb=9e2ff880f3cbc0b4ec8505ad2ce4a1c92d7f6d56>) , you would notice :
> 
>  CFLAGS="$CFLAGS -fno-unwind-tables" or -fno-unwind-tables is getting added to the cflags during configure.
> 
> This is conflicting with -fasynchronous-unwind-tables that I passed. And I am getting following error :
> =======================================================================================
> 
> arm-linux-gnueabihf-gcc  -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard  --sysroot=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot  -isystem/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include -I/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot/usr/include -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0=/usr/src/debug/glibc/linaro-2.25-r0 -fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot= -fdebug-prefix-map=/yocto/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/glibc/linaro-2.25-r0/recipe-sysroot-native= * -fasynchronous-unwind-tables -fno-unwind-tables *  -L/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib
> -Wl,-rpath-link,/opt/archive-pkgs/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -Wl,-z,relro,-z,now -fno-stack-protector -o conftest
>                conftest.c -static -nostartfiles -nostdlib
>                1>&5
> /tmp/ccbJ1zoJ.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
> /tmp/ccbJ1zoJ.o:(.ARM.exidx.text.startup+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
> /tmp/ccbJ1zoJ.o:(.ARM.exidx.text.exit+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
> collect2: error: ld returned 1 exit status
> configure:5687: $? = 1
> configure:5707: error: missing __attribute__ ((constructor)) support??
> ======================================================================================

And I have tested with both:

CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"

and

CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2 -fasynchronous-unwind-tables"

I also tested with gcc from ubuntu22 to check if this might something I haven't
enabled on my toolchain (since I don't build all languages), but again I did not
see any issue.

> 
> I am interested to know your config.log after you built. Can you please share ?

Here it is using ubuntu arm cross compiler: https://pastebin.mozilla.org/MeOPhxdM
and here it is gcc-7: https://pastebin.mozilla.org/k0LjKfF6.

I also tested with gcc-7 and glibc 2.25 and again I did not see any configure or build
issue. I am not sure why your compiler is not disabling unwind-tables with an
explicit -fno-unwind-tables option.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-15 12:59     ` Adhemerval Zanella Netto
@ 2023-03-15 14:20       ` Florian Weimer
  2023-03-15 19:52         ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Weimer @ 2023-03-15 14:20 UTC (permalink / raw)
  To: Adhemerval Zanella Netto via Libc-help
  Cc: Abhijit Ray Chaudhury, Adhemerval Zanella Netto

* Adhemerval Zanella Netto via Libc-help:

> And I have tested with both:
>
> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
>
> and
>
> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2 -fasynchronous-unwind-tables"
>
> I also tested with gcc from ubuntu22 to check if this might something
> I haven't enabled on my toolchain (since I don't build all languages),
> but again I did not see any issue.

It probably depends on whether libgcc.a has been built with
optimizations or not.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-15 14:20       ` Florian Weimer
@ 2023-03-15 19:52         ` Adhemerval Zanella Netto
  2023-03-16 10:59           ` Abhijit Ray Chaudhury
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-15 19:52 UTC (permalink / raw)
  To: Florian Weimer, Adhemerval Zanella Netto via Libc-help
  Cc: Abhijit Ray Chaudhury



On 15/03/23 11:20, Florian Weimer wrote:
> * Adhemerval Zanella Netto via Libc-help:
> 
>> And I have tested with both:
>>
>> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
>>
>> and
>>
>> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2 -fasynchronous-unwind-tables"
>>
>> I also tested with gcc from ubuntu22 to check if this might something
>> I haven't enabled on my toolchain (since I don't build all languages),
>> but again I did not see any issue.
> 
> It probably depends on whether libgcc.a has been built with
> optimizations or not.

Indeed this looks like https://sourceware.org/bugzilla/show_bug.cgi?id=29621 .
Does the build work if you manually adds the -fasynchronous-unwind-tables
on config.make?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-15 19:52         ` Adhemerval Zanella Netto
@ 2023-03-16 10:59           ` Abhijit Ray Chaudhury
  2023-03-17 13:37             ` Abhijit Ray Chaudhury
  0 siblings, 1 reply; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-16 10:59 UTC (permalink / raw)
  To: Adhemerval Zanella Netto
  Cc: Florian Weimer, Adhemerval Zanella Netto via Libc-help

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

Hi,

I think the problem lies with the precedence of seemingly conflicting
CFLAGS "-fasynchronous-unwind-tables -fno-unwind-tables" supplied to my
cross toolchain gcc. I compiled a simple C file with "
-fasynchronous-unwind-tables" , it generated an undefined symbol "
`__aeabi_unwind_cpp_pr0'" although compilation was successful without
-static flag. Then I compiled with " -fasynchronous-unwind-tables
-fno-unwind-tables", it still generated the undefined symbol "
`__aeabi_unwind_cpp_pr0'". It suggests " -fno-unwind-tables" does not stop
unwind information in the ELF when I have " -fasynchronous-unwind-tables" .
I then compiled with " -funwind-tables -fno-unwind-table", I did not find
undefined symbol " `__aeabi_unwind_cpp_pr0'"in the generated ELF.

So I will compile glibc with " -funwind-table" instead of "
-fasynchronous-unwind-table"
and let you know the result.

Do you see any problem with this approach ?

Thanking You,
-Abhijit

On Thu, Mar 16, 2023 at 1:22 AM Adhemerval Zanella Netto <
adhemerval.zanella@linaro.org> wrote:

>
>
> On 15/03/23 11:20, Florian Weimer wrote:
> > * Adhemerval Zanella Netto via Libc-help:
> >
> >> And I have tested with both:
> >>
> >> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
> >>
> >> and
> >>
> >> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2
> -fasynchronous-unwind-tables"
> >>
> >> I also tested with gcc from ubuntu22 to check if this might something
> >> I haven't enabled on my toolchain (since I don't build all languages),
> >> but again I did not see any issue.
> >
> > It probably depends on whether libgcc.a has been built with
> > optimizations or not.
>
> Indeed this looks like
> https://sourceware.org/bugzilla/show_bug.cgi?id=29621 .
> Does the build work if you manually adds the -fasynchronous-unwind-tables
> on config.make?
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-16 10:59           ` Abhijit Ray Chaudhury
@ 2023-03-17 13:37             ` Abhijit Ray Chaudhury
  2023-03-20 17:00               ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-17 13:37 UTC (permalink / raw)
  To: Adhemerval Zanella Netto
  Cc: Florian Weimer, Adhemerval Zanella Netto via Libc-help

[-- Attachment #1: Type: text/plain, Size: 2372 bytes --]

Hello Adhemerval,

I could compile glibc with -funwind-table instead of
-fasynchronous-unwind-table. I noticed glibc uses one of the flags for
different files. As far as stack unwinding is concerned , what is the
difference between -fasynchronous-unwind-table and  -funwind-table ?

Thanking You,
-Abhijit

On Thu, Mar 16, 2023 at 4:29 PM Abhijit Ray Chaudhury <
abhijit.ray.chaudhury@gmail.com> wrote:

> Hi,
>
> I think the problem lies with the precedence of seemingly conflicting
> CFLAGS "-fasynchronous-unwind-tables -fno-unwind-tables" supplied to my
> cross toolchain gcc. I compiled a simple C file with "
> -fasynchronous-unwind-tables" , it generated an undefined symbol "
> `__aeabi_unwind_cpp_pr0'" although compilation was successful without
> -static flag. Then I compiled with " -fasynchronous-unwind-tables
> -fno-unwind-tables", it still generated the undefined symbol "
> `__aeabi_unwind_cpp_pr0'". It suggests " -fno-unwind-tables" does not
> stop unwind information in the ELF when I have "
> -fasynchronous-unwind-tables" . I then compiled with " -funwind-tables
> -fno-unwind-table", I did not find  undefined symbol "
> `__aeabi_unwind_cpp_pr0'"in the generated ELF.
>
> So I will compile glibc with " -funwind-table" instead of " -fasynchronous-unwind-table"
> and let you know the result.
>
> Do you see any problem with this approach ?
>
> Thanking You,
> -Abhijit
>
> On Thu, Mar 16, 2023 at 1:22 AM Adhemerval Zanella Netto <
> adhemerval.zanella@linaro.org> wrote:
>
>>
>>
>> On 15/03/23 11:20, Florian Weimer wrote:
>> > * Adhemerval Zanella Netto via Libc-help:
>> >
>> >> And I have tested with both:
>> >>
>> >> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
>> >>
>> >> and
>> >>
>> >> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2
>> -fasynchronous-unwind-tables"
>> >>
>> >> I also tested with gcc from ubuntu22 to check if this might something
>> >> I haven't enabled on my toolchain (since I don't build all languages),
>> >> but again I did not see any issue.
>> >
>> > It probably depends on whether libgcc.a has been built with
>> > optimizations or not.
>>
>> Indeed this looks like
>> https://sourceware.org/bugzilla/show_bug.cgi?id=29621 .
>> Does the build work if you manually adds the -fasynchronous-unwind-tables
>> on config.make?
>>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-17 13:37             ` Abhijit Ray Chaudhury
@ 2023-03-20 17:00               ` Adhemerval Zanella Netto
  2023-03-21 11:30                 ` Abhijit Ray Chaudhury
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-20 17:00 UTC (permalink / raw)
  To: Abhijit Ray Chaudhury
  Cc: Florian Weimer, Adhemerval Zanella Netto via Libc-help

The -fasynchronous-unwind-table usually is used so backtraces works through signal handlers.
Could you check if you build your toolchain with optimization flags (so libgcc is built with
-O2) you can also build with -fasynchronous-unwind-table?

On 17/03/23 10:37, Abhijit Ray Chaudhury wrote:
> Hello Adhemerval,
> 
> I could compile glibc with -funwind-table instead of -fasynchronous-unwind-table. I noticed glibc uses one of the flags for different files. As far as stack unwinding is concerned , what is the difference between -fasynchronous-unwind-table and  -funwind-table ?
> 
> Thanking You,
> -Abhijit
> 
> On Thu, Mar 16, 2023 at 4:29 PM Abhijit Ray Chaudhury <abhijit.ray.chaudhury@gmail.com <mailto:abhijit.ray.chaudhury@gmail.com>> wrote:
> 
>     Hi,
> 
>     I think the problem lies with the precedence of seemingly conflicting CFLAGS "-fasynchronous-unwind-tables -fno-unwind-tables" supplied to my cross toolchain gcc. I compiled a simple C file with " -fasynchronous-unwind-tables" , it generated an undefined symbol " `__aeabi_unwind_cpp_pr0'" although compilation was successful without -static flag. Then I compiled with " -fasynchronous-unwind-tables -fno-unwind-tables", it still generated the undefined symbol " `__aeabi_unwind_cpp_pr0'". It suggests " -fno-unwind-tables" does not stop unwind information in the ELF when I have " -fasynchronous-unwind-tables" . I then compiled with " -funwind-tables -fno-unwind-table", I did not find  undefined symbol " `__aeabi_unwind_cpp_pr0'"in the generated ELF.
> 
>     So I will compile glibc with " -funwind-table" instead of " -fasynchronous-unwind-table" and let you know the result.
> 
>     Do you see any problem with this approach ?
> 
>     Thanking You,
>     -Abhijit
> 
>     On Thu, Mar 16, 2023 at 1:22 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote:
> 
> 
> 
>         On 15/03/23 11:20, Florian Weimer wrote:
>         > * Adhemerval Zanella Netto via Libc-help:
>         >
>         >> And I have tested with both:
>         >>
>         >> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
>         >>
>         >> and
>         >>
>         >> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2 -fasynchronous-unwind-tables"
>         >>
>         >> I also tested with gcc from ubuntu22 to check if this might something
>         >> I haven't enabled on my toolchain (since I don't build all languages),
>         >> but again I did not see any issue.
>         >
>         > It probably depends on whether libgcc.a has been built with
>         > optimizations or not.
> 
>         Indeed this looks like https://sourceware.org/bugzilla/show_bug.cgi?id=29621 <https://sourceware.org/bugzilla/show_bug.cgi?id=29621> .
>         Does the build work if you manually adds the -fasynchronous-unwind-tables
>         on config.make?
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-20 17:00               ` Adhemerval Zanella Netto
@ 2023-03-21 11:30                 ` Abhijit Ray Chaudhury
  2023-03-22 11:56                   ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 12+ messages in thread
From: Abhijit Ray Chaudhury @ 2023-03-21 11:30 UTC (permalink / raw)
  To: Adhemerval Zanella Netto
  Cc: Florian Weimer, Adhemerval Zanella Netto via Libc-help

[-- Attachment #1: Type: text/plain, Size: 3714 bytes --]

Hi Adhemerval,

In my build environment gcc toolchain is installed in docker through apt. I
will try to find the source code and build .

Can you please let me know why you are concentrating on the resolution of "
__aeabi_unwind_cpp_pr0" symbol ? I thought if you give "-fasynchronous-
unwind-tables -fno-unwind-tables", gcc should not even generate the "
__aeabi_unwind_cpp_pr0" symbol. My toolchain wrongly generates it .

Is my understanding correct?

Kindly advise,
-Abhijit

On Mon, Mar 20, 2023 at 10:30 PM Adhemerval Zanella Netto <
adhemerval.zanella@linaro.org> wrote:

> The -fasynchronous-unwind-table usually is used so backtraces works
> through signal handlers.
> Could you check if you build your toolchain with optimization flags (so
> libgcc is built with
> -O2) you can also build with -fasynchronous-unwind-table?
>
> On 17/03/23 10:37, Abhijit Ray Chaudhury wrote:
> > Hello Adhemerval,
> >
> > I could compile glibc with -funwind-table instead of
> -fasynchronous-unwind-table. I noticed glibc uses one of the flags for
> different files. As far as stack unwinding is concerned , what is the
> difference between -fasynchronous-unwind-table and  -funwind-table ?
> >
> > Thanking You,
> > -Abhijit
> >
> > On Thu, Mar 16, 2023 at 4:29 PM Abhijit Ray Chaudhury <
> abhijit.ray.chaudhury@gmail.com <mailto:abhijit.ray.chaudhury@gmail.com>>
> wrote:
> >
> >     Hi,
> >
> >     I think the problem lies with the precedence of seemingly
> conflicting CFLAGS "-fasynchronous-unwind-tables -fno-unwind-tables"
> supplied to my cross toolchain gcc. I compiled a simple C file with "
> -fasynchronous-unwind-tables" , it generated an undefined symbol "
> `__aeabi_unwind_cpp_pr0'" although compilation was successful without
> -static flag. Then I compiled with " -fasynchronous-unwind-tables
> -fno-unwind-tables", it still generated the undefined symbol "
> `__aeabi_unwind_cpp_pr0'". It suggests " -fno-unwind-tables" does not stop
> unwind information in the ELF when I have " -fasynchronous-unwind-tables" .
> I then compiled with " -funwind-tables -fno-unwind-table", I did not find
> undefined symbol " `__aeabi_unwind_cpp_pr0'"in the generated ELF.
> >
> >     So I will compile glibc with " -funwind-table" instead of "
> -fasynchronous-unwind-table" and let you know the result.
> >
> >     Do you see any problem with this approach ?
> >
> >     Thanking You,
> >     -Abhijit
> >
> >     On Thu, Mar 16, 2023 at 1:22 AM Adhemerval Zanella Netto <
> adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>>
> wrote:
> >
> >
> >
> >         On 15/03/23 11:20, Florian Weimer wrote:
> >         > * Adhemerval Zanella Netto via Libc-help:
> >         >
> >         >> And I have tested with both:
> >         >>
> >         >> CC="arm-glibc-linux-gnueabihf-gcc
> -fasynchronous-unwind-tables"
> >         >>
> >         >> and
> >         >>
> >         >> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2
> -fasynchronous-unwind-tables"
> >         >>
> >         >> I also tested with gcc from ubuntu22 to check if this might
> something
> >         >> I haven't enabled on my toolchain (since I don't build all
> languages),
> >         >> but again I did not see any issue.
> >         >
> >         > It probably depends on whether libgcc.a has been built with
> >         > optimizations or not.
> >
> >         Indeed this looks like
> https://sourceware.org/bugzilla/show_bug.cgi?id=29621 <
> https://sourceware.org/bugzilla/show_bug.cgi?id=29621> .
> >         Does the build work if you manually adds the
> -fasynchronous-unwind-tables
> >         on config.make?
> >
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: compiling glibc using -fasynchronous-unwind-tables for arm
  2023-03-21 11:30                 ` Abhijit Ray Chaudhury
@ 2023-03-22 11:56                   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-22 11:56 UTC (permalink / raw)
  To: Abhijit Ray Chaudhury
  Cc: Florian Weimer, Adhemerval Zanella Netto via Libc-help

Hi Abhijit,

I am not sure why you need to build all glibc with -fasynchronous-unwind-tables, my
understanding you need either to improve debugability or performance profiling on
workloads with signals.

And I think this is similar to https://sourceware.org/bugzilla/show_bug.cgi?id=29621 ,
and if it were the case where libgcc was built with -fexceptions but without optimization
we can't support it on glibc at the moment (as Florian has added on last comment).

On 21/03/23 08:30, Abhijit Ray Chaudhury wrote:
> Hi Adhemerval,
> 
> In my build environment gcc toolchain is installed in docker through apt. I will try to find the source code and build .
> 
> Can you please let me know why you are concentrating on the resolution of " __aeabi_unwind_cpp_pr0" symbol ? I thought if you give "-fasynchronous-unwind-tables -fno-unwind-tables", gcc should not even generate the " __aeabi_unwind_cpp_pr0" symbol. My toolchain wrongly generates it .
> 
> Is my understanding correct?
> 
> Kindly advise,
> -Abhijit
> 
> On Mon, Mar 20, 2023 at 10:30 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote:
> 
>     The -fasynchronous-unwind-table usually is used so backtraces works through signal handlers.
>     Could you check if you build your toolchain with optimization flags (so libgcc is built with
>     -O2) you can also build with -fasynchronous-unwind-table?
> 
>     On 17/03/23 10:37, Abhijit Ray Chaudhury wrote:
>     > Hello Adhemerval,
>     >
>     > I could compile glibc with -funwind-table instead of -fasynchronous-unwind-table. I noticed glibc uses one of the flags for different files. As far as stack unwinding is concerned , what is the difference between -fasynchronous-unwind-table and  -funwind-table ?
>     >
>     > Thanking You,
>     > -Abhijit
>     >
>     > On Thu, Mar 16, 2023 at 4:29 PM Abhijit Ray Chaudhury <abhijit.ray.chaudhury@gmail.com <mailto:abhijit.ray.chaudhury@gmail.com> <mailto:abhijit.ray.chaudhury@gmail.com <mailto:abhijit.ray.chaudhury@gmail.com>>> wrote:
>     >
>     >     Hi,
>     >
>     >     I think the problem lies with the precedence of seemingly conflicting CFLAGS "-fasynchronous-unwind-tables -fno-unwind-tables" supplied to my cross toolchain gcc. I compiled a simple C file with " -fasynchronous-unwind-tables" , it generated an undefined symbol " `__aeabi_unwind_cpp_pr0'" although compilation was successful without -static flag. Then I compiled with " -fasynchronous-unwind-tables -fno-unwind-tables", it still generated the undefined symbol " `__aeabi_unwind_cpp_pr0'". It suggests " -fno-unwind-tables" does not stop unwind information in the ELF when I have " -fasynchronous-unwind-tables" . I then compiled with " -funwind-tables -fno-unwind-table", I did not find  undefined symbol " `__aeabi_unwind_cpp_pr0'"in the generated ELF.
>     >
>     >     So I will compile glibc with " -funwind-table" instead of " -fasynchronous-unwind-table" and let you know the result.
>     >
>     >     Do you see any problem with this approach ?
>     >
>     >     Thanking You,
>     >     -Abhijit
>     >
>     >     On Thu, Mar 16, 2023 at 1:22 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org> <mailto:adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>>> wrote:
>     >
>     >
>     >
>     >         On 15/03/23 11:20, Florian Weimer wrote:
>     >         > * Adhemerval Zanella Netto via Libc-help:
>     >         >
>     >         >> And I have tested with both:
>     >         >>
>     >         >> CC="arm-glibc-linux-gnueabihf-gcc -fasynchronous-unwind-tables"
>     >         >>
>     >         >> and
>     >         >>
>     >         >> CC=arm-glibc-linux-gnueabihf-gcc CFLAGS="-O2 -fasynchronous-unwind-tables"
>     >         >>
>     >         >> I also tested with gcc from ubuntu22 to check if this might something
>     >         >> I haven't enabled on my toolchain (since I don't build all languages),
>     >         >> but again I did not see any issue.
>     >         >
>     >         > It probably depends on whether libgcc.a has been built with
>     >         > optimizations or not.
>     >
>     >         Indeed this looks like https://sourceware.org/bugzilla/show_bug.cgi?id=29621 <https://sourceware.org/bugzilla/show_bug.cgi?id=29621> <https://sourceware.org/bugzilla/show_bug.cgi?id=29621 <https://sourceware.org/bugzilla/show_bug.cgi?id=29621>> .
>     >         Does the build work if you manually adds the -fasynchronous-unwind-tables
>     >         on config.make?
>     >
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-22 11:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 10:04 compiling glibc using -fasynchronous-unwind-tables for arm Abhijit Ray Chaudhury
2023-03-14  9:18 ` Abhijit Ray Chaudhury
2023-03-14 18:47 ` Adhemerval Zanella Netto
2023-03-15  8:36   ` Abhijit Ray Chaudhury
2023-03-15 12:59     ` Adhemerval Zanella Netto
2023-03-15 14:20       ` Florian Weimer
2023-03-15 19:52         ` Adhemerval Zanella Netto
2023-03-16 10:59           ` Abhijit Ray Chaudhury
2023-03-17 13:37             ` Abhijit Ray Chaudhury
2023-03-20 17:00               ` Adhemerval Zanella Netto
2023-03-21 11:30                 ` Abhijit Ray Chaudhury
2023-03-22 11:56                   ` Adhemerval Zanella Netto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).