[lkml]   [2008]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectDetecting endianness in scripts/
Presently there doesn't seem to be any way to determine whether the
target is big or little endian, and it is assumed that the compiler will
do the right thing by default. Unfortunately this can not be assumed,
and mismatches ensue, resulting in the linker bailing out.

The only obvious solution I saw was to pass in KBUILD_CFLAGS and ld_flags
along with $(CC) and $(LD) to the script, and killing off the hardcoded
flags. This at least gets things building, but that still leaves objcopy
and objdump as the odd ones out. On the other hand, the format can be figured
out by objdumping the object and reading in the file format line, but people
obviously do not have consistent naming for these, and a double-pass would
be needed -- once for establishing little or big, followed by figuring out
which set of regexes to use.

The CONFIG_64BIT test could likewise be adopted for testing endianness, but
not all architectures have config options for endian selections. Likewise, a
simple test program to check if __LITTLE_ENDIAN is set or not won't work
without having knowledge of KBUILD_CFLAGS, in which case it seems saner just
to pass it off as a starting point.

Any better ideas?


diff --git a/scripts/ b/scripts/
index 7a17677..de2cc42 100644
--- a/scripts/
+++ b/scripts/
@@ -201,7 +201,8 @@ endif
cmd_record_mcount = perl $(srctree)/scripts/ "$(ARCH)" \
"$(if $(CONFIG_64BIT),64,32)" \
- "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" "$(@)";
+ "$(LD) $(ld_flags)" "$(NM)" "$(RM)" "$(MV)" "$(@)";

define rule_cc_o_c

 \ /
  Last update: 2008-11-26 09:43    [W:0.038 / U:0.292 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site