Hi all!

Recently I attempted to build glibc-2.31 with --enable-static-pie (gcc-9.3.0).
Some targets work just fine, some don't. A few faulty ones so far are:

- alpha-unknown-linux-gnu
- hppa-unknown-linux-gnu
- hppa2.0-unknown-linux-gnu
- m68k-unknown-linux-gnu
- sparc-unknown-linux-gnu
- sparc64-unknown-linux-gnu

Build failure looks roughly the same for them:

alpha-unknown-linux-gnu-gcc  -pipe -fdiagnostics-show-option -Wall -Wextra 
-Wstack-protector -O2 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -nostdlib 
-nostartfiles -static -o 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/elf/sln
 -static-pie    
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/csu/rcrt1.o
 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/csu/crti.o
 `alpha-unknown-linux-gnu-gcc  -pipe -fdiagnostics-show-option -Wall -Wextra 
-Wstack-protector -O2 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu  
--print-file-name=crtbeginS.o` 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/elf/sln.o
 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/elf/static-stubs.o
  -Wl,-z,now -Wl,--start-group 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/libc.a
 -lgcc  -Wl,--end-group `alpha-unknown-linux-gnu-gcc  -pipe 
-fdiagnostics-show-option -Wall -Wextra -Wstack-protector -O2 -Wl,-O1 
-Wl,--as-needed -Wl,--hash-style=gnu  --print-file-name=crtendS.o` 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/csu/crtn.o
/usr/libexec/gcc/alpha-unknown-linux-gnu/ld: 
/tmp/portage/cross-alpha-unknown-linux-gnu/glibc-9999/work/build-default-alpha-unknown-linux-gnu-nptl/libc.a(dl-reloc-static-pie.o):
 in function `_dl_relocate_static_pie':
(.text+0x48): undefined reference to `_DYNAMIC'

Compiler driver calls ld as:
    --eh-frame-hdr -m elf64alpha -static 

On a working x86_64 target ld parameters are:
    --eh-frame-hdr -m elf_x86_64 -static -pie --no-dynamic-linker -z text -pie

Looking at gcc commit that added -static-pie:
    
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=8c6562e12bf7d1406474cbba832073a4afe5687c
is it an unintended lack of '-pie --no-dynamic-linker' on alpha and friends?
Or some ports don't really need it?

Or maybe alpha and friends need more work on binutils/glibc side before adding 
it?

-- 

  Sergei

Attachment: pgpywalDp3Qo1.pgp
Description: Цифровая подпись OpenPGP

Reply via email to