Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 211947
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo's Team for Core System packages <base-system@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 211947 depends on: Show dependency tree
Bug 211947 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-03-01 04:42 0000
When cross compiling "bash", an intermediate program builtins/mkbuiltins are
compiled by CC_FOR_BUILD and linked by LD_FOR_BUILD.
But at that time, linker options are LDFLAGS(flags for target), instead of
LDFLAGS_FOR_BUILD.
This results in linking failure when flags for targets and host are
incompatible.


Reproducible: Always

Steps to Reproduce:
1.Setup cross compiling environment according to "Gentoo embedded howto".
2.Set target specific LDFLAGS in target make.conf (eg. --sysroot=xxx, which
doesn't usually enabled on host)
3.xmerge bash 2>&1  | egrep '^gcc .* -o mkbuiltins ' 

Actual Results:  
gcc -Wl,-z,relro -Wl,-O1 -rdynamic -O2 -m4 -pipe -o mkbuiltin
# on my i686-pc-linux-gnu host, for sh4-unknown-linux-gnu target.

Expected Results:  
gcc -rdynamic -g -DCROSS_COMPILING -o mkbuiltins mkbuiltins.o -ldl


This is because LDFLAGS_FOR_BUILD comes from LDFLAGS as in builtins/Makefile.in
 LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
 LDFLAGS_FOR_BUILD = $(LDFLAGS)
possible solution is
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)

Following patch works for me.
--- bash-3.2/builtins/Makefile.inorg    2008-02-27 03:58:47.000000000 +0900
+++ bash-3.2/builtins/Makefile.in       2008-02-27 03:59:40.000000000 +0900
@@ -63,7 +63,7 @@ LOCAL_DEFS = @LOCAL_DEFS@

 LIBS = @LIBS@
 LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
-LDFLAGS_FOR_BUILD = $(LDFLAGS)
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
 LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
 #LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
 LIBS_FOR_BUILD = $(LIBS)

------- Comment #1 From SpanKY 2008-03-01 20:40:19 0000 -------
please do not post patches inline ... bugzilla destroys such text.  always post
patches as attachments.

there were a few more places where LDFLAGS_FOR_BUILD was being used and i fixed
those as well

added to cvs and sent upstream, cheers

http://sources.gentoo.org/app-shells/bash/bash-3.2_p33.ebuild?r1=1.4&r2=1.5
http://sources.gentoo.org/app-shells/bash/files/bash-3.2-ldflags-for-build.patch?rev=1.1

------- Comment #2 From Takashi YOSHII 2008-03-02 02:10:06 0000 -------
I've confirmed it had fixed, and successfully emerged. Thank you.
metadata/timestamp was "Sun Mar  2 01:08:51 UTC 2008" (Sorry, but I don't known
how to describe the version).

> please do not post patches inline ... <snip>
Thank you for your instructions.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug