Bug #4687
closedsimtrace2 dpkg fails to build on Ubuntu 20.04
100%
Description
[ 207s] ram: 11664 B 48 KB 23.73/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 180 bytes [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o: in function `USBD_IrqHandler': [ 207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c:1229: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `ComputeLockRange': [ 207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:138: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Write': [ 207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:275: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Unlock': [ 207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:366: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o: in function `USBDDriver_RequestHandler': [ 207s] ./firmware/./atmel_softpack_libraries/usb/device/core/USBDDriver.c:672: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `snprintf': [ 207s] ./firmware/libcommon/source/stdio.c:408: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf': [ 207s] ./firmware/libcommon/source/stdio.c:448: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf_sync': [ 207s] ./firmware/libcommon/source/stdio.c:478: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf': [ 207s] ./firmware/libcommon/source/stdio.c:539: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf_sync': [ 207s] ./firmware/libcommon/source/stdio.c:558: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o: in function `UART_Configure': [ 207s] ./firmware/libboard/common/source/uart_console.c:110: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o: in function `board_override_enter_dfu': [ 207s] ./firmware/libboard/qmod/source/board_qmod.c:408: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o: in function `USBDFU_handle_dnload': [ 207s] ./firmware/apps/dfu/main.c:150: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o: in function `set_usb_serial_str': [ 207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_desc.c:211: warning: undefined reference to `__stack_chk_fail' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard' [ 207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o: in function `handle_getstate': [ 207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c:91: warning: undefined reference to `__stack_chk_fail' [ 207s] collect2: error: ld returned 1 exit status
Intrestingly, the problem does not appear when manually building inside a ubuntu 20.04 lxc container. So it must somehow be related to which compiler flags are used during dpkg builds
Related issues
Updated by laforge over 3 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
See https://antoinealb.net/programming/2016/06/01/stack-smashing-protector-on-microcontrollers.html for an introduction into the topic
Updated by laforge over 3 years ago
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-stackprotector
in
debian/rules
works around the problem - but then this means even the host binaries are built without stack smashing protection :/
We would want to enable this selectively for the firmware sub-directory
Updated by laforge over 3 years ago
laforge wrote:
We would want to enable this selectively for the firmware sub-directory
I did try any combinations of export / variable assignments, but I couldn't get dpkg to build the 'firmware' target with different DEB_BUILD_MAINT_OPTIONS than the host utilitites :/
Updated by laforge over 3 years ago
- Status changed from In Progress to Stalled
I posted the question to the debian-dpkg mailing list
Updated by fixeria over 3 years ago
Hi Harald,
why not to simply add the missing symbols?
The '__stack_chk_guard' is basically a magic value (e.g. 0xdeadbeef), and '__stack_chk_fail' is a user-defined function that will be called if the stack is corrupted. It could basically call osmo_panic().
This code should make the linker happy:
uintptr_t __stack_chk_guard = 0xdeadbeef; // adapt to the word width of your architecture void __stack_chk_fail(void) { osmo_panic("Stack smashing detected!\n"); }
Best regards,
Vadim.
Updated by laforge over 3 years ago
- Status changed from Stalled to In Progress
- % Done changed from 10 to 30
fixeria wrote:
Hi Harald,
why not to simply add the missing symbols?
Thanks a lot for pointing tihs out. I thought we'd have to provide more 'intelligence' than those two simply symbols.
Updated by laforge over 3 years ago
- % Done changed from 30 to 80
Updated by laforge about 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
there's another build failure now on Ubuntu 20.04: The compiler simply creates too large binary code to fit into memory. But this is not what this ticket was about.
Updated by osmith about 3 years ago
- Related to Bug #5081: simtrace2 doesn't build for ubuntu 20.04 and 20.10 and debian9 added