public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on
@ 2022-11-29 12:00 linzhuorong at huawei dot com
  2022-11-29 12:23 ` [Bug dynamic-link/29835] " linzhuorong at huawei dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-11-29 12:00 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

            Bug ID: 29835
           Summary: Error compiling glibc multilib with
                    --enable-static-pie option turned on
           Product: glibc
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: linzhuorong at huawei dot com
                CC: carlos at redhat dot com
  Target Milestone: ---

The patch that caused the error:
https://sourceware.org/git/?p=glibc.git;a=commit;h=bca0f5cbc9257c13322b99e55235c4f21ba0bd82

Error when compiling glibc with gcc-10.3.0 compiler with --enable-static-pie
enabled

Log:

/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld:
/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/libc.a(dl-reloc-static-pie.o):
in function elf_machine_rel':
/home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440:
undefined reference to _DYNAMIC'
/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld:
/home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440:
undefined reference to _DYNAMIC'
/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld:
/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/elf/sln:
hidden symbol _DYNAMIC' isn't defined
/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld:
final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: ***
[/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/elf/sln]
Error 1
../Rules:293: recipe for target
'/home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/elf/sln'
failed
make[2]: Leaving directory
'/home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf'
make[1]: *** [elf/subdir_install] Error 2
Makefile:478: recipe for target 'elf/subdir_install' failed
make[1]: Leaving directory
'/home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34'
Makefile:12: recipe for target 'install' failed
make: *** [install] Error 2
~/workspace/compiler/gcc/build/arm-linux-glibc
~/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/platform
~/workspace/compiler/gcc/build/arm-linux-glibc
cd ./secure_c/src && make
make[1]: Entering directory
'/home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/platform/secure_c/src'

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
@ 2022-11-29 12:23 ` linzhuorong at huawei dot com
  2022-11-29 12:24 ` linzhuorong at huawei dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-11-29 12:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

lin zhuorong <linzhuorong at huawei dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|build                       |dynamic-link

--- Comment #1 from lin zhuorong <linzhuorong at huawei dot com> ---
I think Static executables do not have symbol _DYNAMIC

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
  2022-11-29 12:23 ` [Bug dynamic-link/29835] " linzhuorong at huawei dot com
@ 2022-11-29 12:24 ` linzhuorong at huawei dot com
  2022-11-29 12:54 ` schwab@linux-m68k.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-11-29 12:24 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

lin zhuorong <linzhuorong at huawei dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.37                        |2.38

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
  2022-11-29 12:23 ` [Bug dynamic-link/29835] " linzhuorong at huawei dot com
  2022-11-29 12:24 ` linzhuorong at huawei dot com
@ 2022-11-29 12:54 ` schwab@linux-m68k.org
  2022-12-02  9:52 ` schwab@linux-m68k.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2022-11-29 12:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maskray at google dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (2 preceding siblings ...)
  2022-11-29 12:54 ` schwab@linux-m68k.org
@ 2022-12-02  9:52 ` schwab@linux-m68k.org
  2022-12-02 22:02 ` i at maskray dot me
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2022-12-02  9:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
*** Bug 29840 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (3 preceding siblings ...)
  2022-12-02  9:52 ` schwab@linux-m68k.org
@ 2022-12-02 22:02 ` i at maskray dot me
  2022-12-05  1:50 ` linzhuorong at huawei dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: i at maskray dot me @ 2022-12-02 22:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

Fangrui Song <i at maskray dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |i at maskray dot me

--- Comment #3 from Fangrui Song <i at maskray dot me> ---
How do you configure your build?


mkdir -p out/arm && cd out/arm
../../configure --prefix=/tmp/glibc/arm --host=arm-linux-gnueabihf
--enable-static-pie --enable-hardcoded-path-in-tests
make -j 60  # good

% grep pie_supported config.log
libc_cv_pie_supported=yes
libc_cv_static_pie_supported=no

Note that sysdeps/arm/configure.ac doesn't say `AC_DEFINE(SUPPORT_STATIC_PIE)`,
so I think static-pie for sysdeps/arm is unsupported.


% cat a.c
const char *foo (void)
{
  extern const char _DYNAMIC[] __attribute__((visibility("hidden")));
  return _DYNAMIC;
}
% arm-linux-gnueabihf-gcc -fpic  -nostdlib -static-pie a.c
# good. Both -shared and -pie have .dynamic and define _DYNAMIC

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (4 preceding siblings ...)
  2022-12-02 22:02 ` i at maskray dot me
@ 2022-12-05  1:50 ` linzhuorong at huawei dot com
  2022-12-06 10:56 ` schwab@linux-m68k.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-12-05  1:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

--- Comment #4 from lin zhuorong <linzhuorong at huawei dot com> ---
configure:

CC="$PREFIX/bin/$TARGET-gcc $CFLAGS_FOR_TARGET -Wno-error=maybe-uninitialized
-mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-vfpv4 -D SUPPORT_STATIC_PIE"
LDFLAGS="${SECURE_LDFLAGS}" CXX="$PREFIX/bin/$TARGET-g++ $CFLAGS_FOR_TARGET
-Wno-error=maybe-uninitialized -mcpu=cortex-a53 -mfloat-abi=hard
-mfpu=neon-vfpv4" $ROOT_TAR_SRC/$GLIBC/configure --prefix=/usr
--with-headers=$SYSROOT/usr/include/ --build=$BUILD  --host=$TARGET
--enable-profile --without-gd --without-cvs --disable-multi-arch
--enable-obsolete-rpc --enable-add-ons --enable-stack-protector=strong
libc_cv_ssp=yes --enable-static-pie
make -j $PARALLEL
make install_root=$SYSROOT install

I want to get statically linked sln
It is work in the gcc 7.3.0 version, but build error in the gcc 10.3.0

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (5 preceding siblings ...)
  2022-12-05  1:50 ` linzhuorong at huawei dot com
@ 2022-12-06 10:56 ` schwab@linux-m68k.org
  2022-12-06 12:14 ` linzhuorong at huawei dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2022-12-06 10:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
You cannot just define SUPPORT_STATIC_PIE when in fact support for static pie
is not existing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (6 preceding siblings ...)
  2022-12-06 10:56 ` schwab@linux-m68k.org
@ 2022-12-06 12:14 ` linzhuorong at huawei dot com
  2022-12-06 12:38 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-12-06 12:14 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

--- Comment #6 from lin zhuorong <linzhuorong at huawei dot com> ---
Why it works in 7.3.0, but compiles error in 10.3.0?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (7 preceding siblings ...)
  2022-12-06 12:14 ` linzhuorong at huawei dot com
@ 2022-12-06 12:38 ` schwab@linux-m68k.org
  2022-12-07 12:50 ` linzhuorong at huawei dot com
  2022-12-18  0:33 ` i at maskray dot me
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2022-12-06 12:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

--- Comment #7 from Andreas Schwab <schwab@linux-m68k.org> ---
Because gcc 7 does not know anything about static-pie.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (8 preceding siblings ...)
  2022-12-06 12:38 ` schwab@linux-m68k.org
@ 2022-12-07 12:50 ` linzhuorong at huawei dot com
  2022-12-18  0:33 ` i at maskray dot me
  10 siblings, 0 replies; 12+ messages in thread
From: linzhuorong at huawei dot com @ 2022-12-07 12:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

lin zhuorong <linzhuorong at huawei dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #8 from lin zhuorong <linzhuorong at huawei dot com> ---
(In reply to Fangrui Song from comment #3)
> How do you configure your build?
> 
> 
> mkdir -p out/arm && cd out/arm
> ../../configure --prefix=/tmp/glibc/arm --host=arm-linux-gnueabihf
> --enable-static-pie --enable-hardcoded-path-in-tests
> make -j 60  # good
> 
> % grep pie_supported config.log
> libc_cv_pie_supported=yes
> libc_cv_static_pie_supported=no
> 
> Note that sysdeps/arm/configure.ac doesn't say
> `AC_DEFINE(SUPPORT_STATIC_PIE)`, so I think static-pie for sysdeps/arm is
> unsupported.
> 
> 
> % cat a.c
> const char *foo (void)
> {
>   extern const char _DYNAMIC[] __attribute__((visibility("hidden")));
>   return _DYNAMIC;
> }
> % arm-linux-gnueabihf-gcc -fpic  -nostdlib -static-pie a.c
> # good. Both -shared and -pie have .dynamic and define _DYNAMIC

What version of gcc are you using?

I used gcc 10.3.0 to compile the above a.c and also got the error undefined
reference to '_DYNAMIC'

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/29835] Error compiling glibc multilib with --enable-static-pie option turned on
  2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
                   ` (9 preceding siblings ...)
  2022-12-07 12:50 ` linzhuorong at huawei dot com
@ 2022-12-18  0:33 ` i at maskray dot me
  10 siblings, 0 replies; 12+ messages in thread
From: i at maskray dot me @ 2022-12-18  0:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29835

Fangrui Song <i at maskray dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #9 from Fangrui Song <i at maskray dot me> ---
sysdeps/arm/configure.ac doesn't say `AC_DEFINE(SUPPORT_STATIC_PIE)`, so
static-pie isn't supported by the port yet. It's not correct to supply -D
SUPPORT_STATIC_PIE and pretend that it is working.

The reason could be in glibc or in binutils ld.bfd (i.e. the linker may need
some patches to properly support static pie). Then the glibc build system may
need to detect whether the linker is capable of static pie.

GCC not supporting static-pie has such an error:

    error: unrecognized option '-static-pie'

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2022-12-18  0:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 12:00 [Bug build/29835] New: Error compiling glibc multilib with --enable-static-pie option turned on linzhuorong at huawei dot com
2022-11-29 12:23 ` [Bug dynamic-link/29835] " linzhuorong at huawei dot com
2022-11-29 12:24 ` linzhuorong at huawei dot com
2022-11-29 12:54 ` schwab@linux-m68k.org
2022-12-02  9:52 ` schwab@linux-m68k.org
2022-12-02 22:02 ` i at maskray dot me
2022-12-05  1:50 ` linzhuorong at huawei dot com
2022-12-06 10:56 ` schwab@linux-m68k.org
2022-12-06 12:14 ` linzhuorong at huawei dot com
2022-12-06 12:38 ` schwab@linux-m68k.org
2022-12-07 12:50 ` linzhuorong at huawei dot com
2022-12-18  0:33 ` i at maskray dot me

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).