Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 598004 - sys-boot/refind: undefined reference to memcpy with -O{2,3}
Summary: sys-boot/refind: undefined reference to memcpy with -O{2,3}
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Stéphane Veyret
URL: https://github.com/gentoo/gentoo/pull...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-24 16:45 UTC by Göktürk Yüksek
Modified: 2016-11-06 17:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Göktürk Yüksek archtester gentoo-dev 2016-10-24 16:45:30 UTC
The linking phase fails for the version 0.10.3 with '-02' and '-O3':

x86_64-pc-linux-gnu-ld -o refind_x64.dll -n -q --gc-sections -nostdlib          --script=/usr/lib/GccBase.lds           --defsym=PECOFF_HEADER_SIZE=0x228           --entry efi_main -u efi_main -m elf_x86_64 \
      -L /usr/lib --start-group -lBaseDebugPrintErrorLevelLib -lBasePrintLib -lBasePcdLibNull -lUefiDebugLibStdErr -lBaseLib -lBaseMemoryLib -lUefiBootServicesTableLib -lUefiMemoryAllocationLib -lUefiRuntimeServicesTableLib -lUefiDevicePathLib -lUefiLib -lPeCoffExtraActionLibNull -lUefiApplicationEntryPoint -lDxeServicesLib -lDxeServicesTableLib -lDxeHobLib -lBasePeCoffLib apple.obj config.obj mystrings.obj line_edit.obj driver_support.obj icns.obj lib.obj main.obj menu.obj screen.obj gpt.obj crc32.obj legacy.obj AutoGen.obj ../libeg/libeg.lib \
      ../EfiLib/EfiLib.lib ../mok/mok.lib --end-group
../libeg/libeg.lib(lodepng.obj): In function `lodepng_state_copy':
lodepng.c:(.text+0x4f65): undefined reference to `memcpy'
Make.tiano:48: recipe for target 'refind_x64.dll' failed
make[1]: *** [refind_x64.dll] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-boot/refind-0.10.3/work/refind-0.10.3/refind'
Makefile:54: recipe for target 'tiano' failed
make: *** [tiano] Error 2

This is likely due to gcc inserting mem* functions as part of its optimizations and us linking with '-nostdlib'. Overriding with '-Os' as done by the upstream seems like a good workaround for the issue for now.

This bug is filed prior to the commit that will introduce the version 0.10.3 to the tree so it can be referenced in the ebuild.
Comment 1 Stéphane Veyret 2016-11-05 20:10:47 UTC
This problem should become not applicable with the PR:
https://github.com/gentoo/gentoo/pull/2754
Comment 2 Stéphane Veyret 2016-11-06 17:15:12 UTC
As an EFI application is not a Linux application, it is nonesence to use user defined CFLAGS and LDFLAGS. So the problem is fixed by using only upstream defined flags.
Note that adventurers can use the custom-cflags flag when merging refind to force refind using user defined CFLAGS, but this is unsupported.