Message ID | 3c9e82d8-f46e-4fd5-8e74-b654a2e3772b@kernel.org |
---|---|
State | Not Applicable |
Headers | show |
Series | [uclibc-ng-devel] Re: [PATCH] elf: support ELF binaries in noMMU | expand |
Hi Greg, Greg Ungerer wrote, > Hi Waldemar, > > On 1/12/23 18:31, Waldemar Brodkorb wrote: > > THis breaks static building of target alpha: > > > > /home/wbx/embedded-test/openadk/toolchain_qemu-alpha_uclibc-ng/usr/bin/alpha-openadk-linux-uclibc-gcc -c libc/misc/auxvt/getauxval.c -o libc/misc/auxvt/getauxval.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wp > > In file included from ./ldso/include/ldso.h:189, > > from libc/misc/auxvt/getauxval.c:21: > > ./ldso/include/dl-defs.h:76:10: fatal error: dl-sysdep.h: No such file or directory > > 76 | #include <dl-sysdep.h> > > | ^~~~~~~~~~~~~ > > compilation terminated. > > gmake[6]: *** [Makerules:372: libc/misc/auxvt/getauxval.os] Error 1 > > > > I think it is this part of the patch: > > diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h > > index daa6685cb..e404f17ec 100644 > > --- a/ldso/include/dl-defs.h > > +++ b/ldso/include/dl-defs.h > > @@ -72,10 +72,8 @@ typedef struct { > > #endif > > #ifdef _LIBC > > -#ifndef __ARCH_HAS_NO_SHARED__ > > /* arch specific defines */ > > #include <dl-sysdep.h> > > -#endif > > #ifdef __TARGET_c6x__ > > #include <dl-sysdep.h> > > #endif > > > > Any idea? > > Yes, that is definitely the cause. I mis-understood the implications > of removing that "#ifndef __ARCH_HAS_NO_SHARED__" conditional. > > I am testing a different change here that I think might do ther job better: > > --- a/ldso/include/dl-defs.h > +++ b/ldso/include/dl-defs.h > @@ -72,7 +72,7 @@ > #endif > > #ifdef _LIBC > -#ifndef __ARCH_HAS_NO_SHARED__ > +#ifndef __ARCH_HAS_NO_LDSO__ > /* arch specific defines */ > #include <dl-sysdep.h> > #endif That fixes the alpha problem, thanks. But now it fails for ARM FDPIC target. /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/bin/arm-openadk-uclinuxfdpiceabi-gcc -c libc/misc/internals/reloc_static_pie.c -o libc/misc/intern als/reloc_static_pie.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wno-nonnull-compare -funsigned-char -fno-builtin -fcommon -fno-asm -fmerge-all-constants -msoft-float -std=gnu99 -mlittle-endian -fno-stack-pro tector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/arm -I./libc/sysdeps/linux -I./ldso/ldso/arm -I./ldso/include -I. -DSTATIC -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=ar m926ej-s -mfpu=vfp -mfloat-abi=soft -Os -pipe -fomit-frame-pointer -marm -Wa,-mfloat-abi=soft -I./libc/sysdeps/linux/common -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926 ej_s_soft_eabi_fdpic_arm_nommu/usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include-fixed -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/ usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include -I/home/wbx/embedded-test/openadk/target_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/include/ -DNDEBUG -fPIC -fno-stack-protecto r -DL_rcrt1 -MT libc/misc/internals/reloc_static_pie.os -MD -MP -MF libc/misc/internals/.reloc_static_pie.os.dep In file included from ./include/elf.h:29, from ./include/link.h:24, from libc/misc/internals/reloc_static_pie.c:19: ./ldso/include/dl-syscall.h: In function '_dl_pread': ./ldso/include/dl-syscall.h:234:76: warning: right shift count >= width of type [-Wshift-count-overflow] 234 | return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR((offset >> 32), (offset & 0xffffffff))); | ^~ ./include/endian.h:52:39: note: in definition of macro '__LONG_LONG_PAIR' 52 | # define __LONG_LONG_PAIR(HI, LO) LO, HI | ^~ In file included from ./ldso/ldso/arm/dl-inlines.h:1, from ./ldso/include/ldso.h:185, from libc/misc/internals/reloc_static_pie.c:23: ./ldso/ldso/arm/../fdpic/dl-inlines.h: In function '_dl_funcdesc_for': ./ldso/ldso/arm/../fdpic/dl-inlines.h:180:15: warning: assignment to 'struct funcdesc_value **' from incompatible pointer type 'void **' [-Wincompatible-pointer-types] 180 | entry = htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer); | ^ In file included from ./ldso/ldso/arm/dl-sysdep.h:144, from ./ldso/include/dl-defs.h:77, from ./ldso/include/dl-string.h:15, from ./ldso/include/dl-elf.h:12, from libc/misc/internals/reloc_static_pie.c:21: libc/misc/internals/reloc_static_pie.c: In function 'reloc_static_pie': ./ldso/ldso/arm/../fdpic/dl-sysdep.h:88:43: error: 'dl_boot_got_pointer' undeclared (first use in this function) 88 | #define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer) ... Any idea? best regards Waldemar
Hi Waldemar, On 6/12/23 19:48, Waldemar Brodkorb wrote: > Hi Greg, > Greg Ungerer wrote, > >> Hi Waldemar, >> >> On 1/12/23 18:31, Waldemar Brodkorb wrote: >>> THis breaks static building of target alpha: >>> >>> /home/wbx/embedded-test/openadk/toolchain_qemu-alpha_uclibc-ng/usr/bin/alpha-openadk-linux-uclibc-gcc -c libc/misc/auxvt/getauxval.c -o libc/misc/auxvt/getauxval.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wp >>> In file included from ./ldso/include/ldso.h:189, >>> from libc/misc/auxvt/getauxval.c:21: >>> ./ldso/include/dl-defs.h:76:10: fatal error: dl-sysdep.h: No such file or directory >>> 76 | #include <dl-sysdep.h> >>> | ^~~~~~~~~~~~~ >>> compilation terminated. >>> gmake[6]: *** [Makerules:372: libc/misc/auxvt/getauxval.os] Error 1 >>> >>> I think it is this part of the patch: >>> diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h >>> index daa6685cb..e404f17ec 100644 >>> --- a/ldso/include/dl-defs.h >>> +++ b/ldso/include/dl-defs.h >>> @@ -72,10 +72,8 @@ typedef struct { >>> #endif >>> #ifdef _LIBC >>> -#ifndef __ARCH_HAS_NO_SHARED__ >>> /* arch specific defines */ >>> #include <dl-sysdep.h> >>> -#endif >>> #ifdef __TARGET_c6x__ >>> #include <dl-sysdep.h> >>> #endif >>> >>> Any idea? >> >> Yes, that is definitely the cause. I mis-understood the implications >> of removing that "#ifndef __ARCH_HAS_NO_SHARED__" conditional. >> >> I am testing a different change here that I think might do ther job better: >> >> --- a/ldso/include/dl-defs.h >> +++ b/ldso/include/dl-defs.h >> @@ -72,7 +72,7 @@ >> #endif >> >> #ifdef _LIBC >> -#ifndef __ARCH_HAS_NO_SHARED__ >> +#ifndef __ARCH_HAS_NO_LDSO__ >> /* arch specific defines */ >> #include <dl-sysdep.h> >> #endif > > That fixes the alpha problem, thanks. > > But now it fails for ARM FDPIC target. > > /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/bin/arm-openadk-uclinuxfdpiceabi-gcc -c libc/misc/internals/reloc_static_pie.c -o libc/misc/intern > als/reloc_static_pie.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wno-nonnull-compare -funsigned-char -fno-builtin -fcommon -fno-asm -fmerge-all-constants -msoft-float -std=gnu99 -mlittle-endian -fno-stack-pro > tector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/arm -I./libc/sysdeps/linux -I./ldso/ldso/arm -I./ldso/include -I. -DSTATIC -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=ar > m926ej-s -mfpu=vfp -mfloat-abi=soft -Os -pipe -fomit-frame-pointer -marm -Wa,-mfloat-abi=soft -I./libc/sysdeps/linux/common -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926 > ej_s_soft_eabi_fdpic_arm_nommu/usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include-fixed -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/ > usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include -I/home/wbx/embedded-test/openadk/target_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/include/ -DNDEBUG -fPIC -fno-stack-protecto > r -DL_rcrt1 -MT libc/misc/internals/reloc_static_pie.os -MD -MP -MF libc/misc/internals/.reloc_static_pie.os.dep Ok, this is strange. I don't see this with my ARM fdpic testing. Can you send me your uClibc-ng .config file? reloc_static_pie.os is only compiled if STATIC_PIE is enabled (as per libc/misc/internals/Makefile.in) and STATIC_PIE can only be set if !UCLIBC_FORMAT_FDPIC_ELF is true (as per extra/Configs/Config.in). Unless I am missing something? Regards Greg > In file included from ./include/elf.h:29, > from ./include/link.h:24, > from libc/misc/internals/reloc_static_pie.c:19: > ./ldso/include/dl-syscall.h: In function '_dl_pread': > ./ldso/include/dl-syscall.h:234:76: warning: right shift count >= width of type [-Wshift-count-overflow] > 234 | return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR((offset >> 32), (offset & 0xffffffff))); > | ^~ > ./include/endian.h:52:39: note: in definition of macro '__LONG_LONG_PAIR' > 52 | # define __LONG_LONG_PAIR(HI, LO) LO, HI > | ^~ > In file included from ./ldso/ldso/arm/dl-inlines.h:1, > from ./ldso/include/ldso.h:185, > from libc/misc/internals/reloc_static_pie.c:23: > ./ldso/ldso/arm/../fdpic/dl-inlines.h: In function '_dl_funcdesc_for': > ./ldso/ldso/arm/../fdpic/dl-inlines.h:180:15: warning: assignment to 'struct funcdesc_value **' from incompatible pointer type 'void **' [-Wincompatible-pointer-types] > 180 | entry = htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer); > | ^ > In file included from ./ldso/ldso/arm/dl-sysdep.h:144, > from ./ldso/include/dl-defs.h:77, > from ./ldso/include/dl-string.h:15, > from ./ldso/include/dl-elf.h:12, > from libc/misc/internals/reloc_static_pie.c:21: > libc/misc/internals/reloc_static_pie.c: In function 'reloc_static_pie': > ./ldso/ldso/arm/../fdpic/dl-sysdep.h:88:43: error: 'dl_boot_got_pointer' undeclared (first use in this function) > 88 | #define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer) > ... > > Any idea? > > best regards > Waldemar
Hi Greg, Greg Ungerer wrote, > Hi Waldemar, > > On 6/12/23 19:48, Waldemar Brodkorb wrote: > > Hi Greg, > > Greg Ungerer wrote, > > > > > Hi Waldemar, > > > > > > On 1/12/23 18:31, Waldemar Brodkorb wrote: > > > > THis breaks static building of target alpha: > > > > > > > > /home/wbx/embedded-test/openadk/toolchain_qemu-alpha_uclibc-ng/usr/bin/alpha-openadk-linux-uclibc-gcc -c libc/misc/auxvt/getauxval.c -o libc/misc/auxvt/getauxval.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wp > > > > In file included from ./ldso/include/ldso.h:189, > > > > from libc/misc/auxvt/getauxval.c:21: > > > > ./ldso/include/dl-defs.h:76:10: fatal error: dl-sysdep.h: No such file or directory > > > > 76 | #include <dl-sysdep.h> > > > > | ^~~~~~~~~~~~~ > > > > compilation terminated. > > > > gmake[6]: *** [Makerules:372: libc/misc/auxvt/getauxval.os] Error 1 > > > > > > > > I think it is this part of the patch: > > > > diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h > > > > index daa6685cb..e404f17ec 100644 > > > > --- a/ldso/include/dl-defs.h > > > > +++ b/ldso/include/dl-defs.h > > > > @@ -72,10 +72,8 @@ typedef struct { > > > > #endif > > > > #ifdef _LIBC > > > > -#ifndef __ARCH_HAS_NO_SHARED__ > > > > /* arch specific defines */ > > > > #include <dl-sysdep.h> > > > > -#endif > > > > #ifdef __TARGET_c6x__ > > > > #include <dl-sysdep.h> > > > > #endif > > > > > > > > Any idea? > > > > > > Yes, that is definitely the cause. I mis-understood the implications > > > of removing that "#ifndef __ARCH_HAS_NO_SHARED__" conditional. > > > > > > I am testing a different change here that I think might do ther job better: > > > > > > --- a/ldso/include/dl-defs.h > > > +++ b/ldso/include/dl-defs.h > > > @@ -72,7 +72,7 @@ > > > #endif > > > > > > #ifdef _LIBC > > > -#ifndef __ARCH_HAS_NO_SHARED__ > > > +#ifndef __ARCH_HAS_NO_LDSO__ > > > /* arch specific defines */ > > > #include <dl-sysdep.h> > > > #endif > > > > That fixes the alpha problem, thanks. > > > > But now it fails for ARM FDPIC target. > > > > /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/bin/arm-openadk-uclinuxfdpiceabi-gcc -c libc/misc/internals/reloc_static_pie.c -o libc/misc/intern > > als/reloc_static_pie.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wno-nonnull-compare -funsigned-char -fno-builtin -fcommon -fno-asm -fmerge-all-constants -msoft-float -std=gnu99 -mlittle-endian -fno-stack-pro > > tector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/arm -I./libc/sysdeps/linux -I./ldso/ldso/arm -I./ldso/include -I. -DSTATIC -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=ar > > m926ej-s -mfpu=vfp -mfloat-abi=soft -Os -pipe -fomit-frame-pointer -marm -Wa,-mfloat-abi=soft -I./libc/sysdeps/linux/common -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926 > > ej_s_soft_eabi_fdpic_arm_nommu/usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include-fixed -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/ > > usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include -I/home/wbx/embedded-test/openadk/target_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/include/ -DNDEBUG -fPIC -fno-stack-protecto > > r -DL_rcrt1 -MT libc/misc/internals/reloc_static_pie.os -MD -MP -MF libc/misc/internals/.reloc_static_pie.os.dep > > Ok, this is strange. I don't see this with my ARM fdpic testing. > > Can you send me your uClibc-ng .config file? The generation of the config file was broken, I fixed it up. I committed and pushed your patch now! Thanks Waldemar
Hi Waldemar, On 12/12/23 14:58, Waldemar Brodkorb wrote: > Hi Greg, > Greg Ungerer wrote, > >> Hi Waldemar, >> >> On 6/12/23 19:48, Waldemar Brodkorb wrote: >>> Hi Greg, >>> Greg Ungerer wrote, >>> >>>> Hi Waldemar, >>>> >>>> On 1/12/23 18:31, Waldemar Brodkorb wrote: >>>>> THis breaks static building of target alpha: >>>>> >>>>> /home/wbx/embedded-test/openadk/toolchain_qemu-alpha_uclibc-ng/usr/bin/alpha-openadk-linux-uclibc-gcc -c libc/misc/auxvt/getauxval.c -o libc/misc/auxvt/getauxval.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wp >>>>> In file included from ./ldso/include/ldso.h:189, >>>>> from libc/misc/auxvt/getauxval.c:21: >>>>> ./ldso/include/dl-defs.h:76:10: fatal error: dl-sysdep.h: No such file or directory >>>>> 76 | #include <dl-sysdep.h> >>>>> | ^~~~~~~~~~~~~ >>>>> compilation terminated. >>>>> gmake[6]: *** [Makerules:372: libc/misc/auxvt/getauxval.os] Error 1 >>>>> >>>>> I think it is this part of the patch: >>>>> diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h >>>>> index daa6685cb..e404f17ec 100644 >>>>> --- a/ldso/include/dl-defs.h >>>>> +++ b/ldso/include/dl-defs.h >>>>> @@ -72,10 +72,8 @@ typedef struct { >>>>> #endif >>>>> #ifdef _LIBC >>>>> -#ifndef __ARCH_HAS_NO_SHARED__ >>>>> /* arch specific defines */ >>>>> #include <dl-sysdep.h> >>>>> -#endif >>>>> #ifdef __TARGET_c6x__ >>>>> #include <dl-sysdep.h> >>>>> #endif >>>>> >>>>> Any idea? >>>> >>>> Yes, that is definitely the cause. I mis-understood the implications >>>> of removing that "#ifndef __ARCH_HAS_NO_SHARED__" conditional. >>>> >>>> I am testing a different change here that I think might do ther job better: >>>> >>>> --- a/ldso/include/dl-defs.h >>>> +++ b/ldso/include/dl-defs.h >>>> @@ -72,7 +72,7 @@ >>>> #endif >>>> >>>> #ifdef _LIBC >>>> -#ifndef __ARCH_HAS_NO_SHARED__ >>>> +#ifndef __ARCH_HAS_NO_LDSO__ >>>> /* arch specific defines */ >>>> #include <dl-sysdep.h> >>>> #endif >>> >>> That fixes the alpha problem, thanks. >>> >>> But now it fails for ARM FDPIC target. >>> >>> /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/bin/arm-openadk-uclinuxfdpiceabi-gcc -c libc/misc/internals/reloc_static_pie.c -o libc/misc/intern >>> als/reloc_static_pie.os -Wall -Wstrict-prototypes -Wstrict-aliasing -Wno-nonnull-compare -funsigned-char -fno-builtin -fcommon -fno-asm -fmerge-all-constants -msoft-float -std=gnu99 -mlittle-endian -fno-stack-pro >>> tector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/arm -I./libc/sysdeps/linux -I./ldso/ldso/arm -I./ldso/include -I. -DSTATIC -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=ar >>> m926ej-s -mfpu=vfp -mfloat-abi=soft -Os -pipe -fomit-frame-pointer -marm -Wa,-mfloat-abi=soft -I./libc/sysdeps/linux/common -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926 >>> ej_s_soft_eabi_fdpic_arm_nommu/usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include-fixed -isystem /home/wbx/embedded-test/openadk/toolchain_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/ >>> usr/lib/gcc/arm-openadk-uclinuxfdpiceabi/13.2.0/include -I/home/wbx/embedded-test/openadk/target_qemu-arm-versatilepb_uclibc-ng_arm926ej_s_soft_eabi_fdpic_arm_nommu/usr/include/ -DNDEBUG -fPIC -fno-stack-protecto >>> r -DL_rcrt1 -MT libc/misc/internals/reloc_static_pie.os -MD -MP -MF libc/misc/internals/.reloc_static_pie.os.dep >> >> Ok, this is strange. I don't see this with my ARM fdpic testing. >> >> Can you send me your uClibc-ng .config file? > > The generation of the config file was broken, I fixed it up. > > I committed and pushed your patch now! Great news, thanks! Regards Greg
--- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -72,7 +72,7 @@ #endif #ifdef _LIBC -#ifndef __ARCH_HAS_NO_SHARED__ +#ifndef __ARCH_HAS_NO_LDSO__ /* arch specific defines */ #include <dl-sysdep.h> #endif