Subject: [alpine-devel] Problem building gnat for armhf

From: "Leslie P. Polzer | PORT ZERO" <[email-masked]>
Date: Mon, 11 Nov 2013 10:49:37 +0100

Hi Timo,

have you by any chance encountered this error when crossbuilding gnat
as part of gcc for armhf:

ada/ali.o: In function `ali__scan_ali__fatal_error__wchar.7321':
ali.adb:(.text+0x1c): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__checkc.7267':
ali.adb:(.text+0xac): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__skip_eol.7302':
ali.adb:(.text+0x144): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__skip_line.7304':
ali.adb:(.text+0x27c): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__get_nat.7284':
ali.adb:(.text+0x340): undefined reference to `_gnat_stack_check'
ada/ali.o:ali.adb:(.text+0x444): more undefined references to `_gnat_stack_check' follow
collect2: error: ld returned 1 exit status
make[2]: *** [gnatbind] Error 1
make[2]: *** Waiting for unfinished jobs....
ada/ali.o: In function `ali__scan_ali__fatal_error__wchar.7321':
ali.adb:(.text+0x1c): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__checkc.7267':
ali.adb:(.text+0xac): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__skip_eol.7302':
ali.adb:(.text+0x144): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__skip_line.7304':
ali.adb:(.text+0x27c): undefined reference to `_gnat_stack_check'
ada/ali.o: In function `ali__scan_ali__get_nat.7284':
ali.adb:(.text+0x340): undefined reference to `_gnat_stack_check'
ada/ali.o:ali.adb:(.text+0x444): more undefined references to `_gnat_stack_check' follow

This is with latest aports and an up to date edge system.
I don't get this when crossbuilding for x86-musl.

It looks like this function isn't defined for armhf, or the
file it is defined in is not included.

  Leslie

-- 
Dipl.Ing.(BA) Leslie P. Polzer | CTO - PORT ZERO
UG (haftungsbeschränkt)
Softwareentwicklung & IT Engineering
Adalbertstraße 7/8
10999 Berlin
Tel.: +49 (0)30 - 69 200 907 - 0
Fax: +49 (0)30 - 69 200 907 - 9
http://www.port-zero.com

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Timo Teras <[email-masked]>
Date: Mon, 11 Nov 2013 11:55:59 +0200

On Mon, 11 Nov 2013 10:49:37 +0100
"Leslie P. Polzer | PORT ZERO" <[email-masked]> wrote:

> ada/ali.o:ali.adb:(.text+0x444): more undefined references to
> `_gnat_stack_check' follow collect2: error: ld returned 1 exit status

I had such issues, but I thought I fixed them all. Namely adding
-fno-stack-check flags to ESP_NOSSP_CFLAGS and stage1_cflags should
have fixed it. Search for "Fix ada bootstrap" in the apkbuild.

Then again when I did my cross compiler things were different. It seems
to be recent addition in piepatches that -fstack-check is enabled by
default. So the issue probably depends how the gcc you use to compile
cross gcc is built. Adding -fno-stack-check should fix it, but where to
add it I'm not fully sure.

- Timo

---