On 14 December 2015 at 10:15, vijay nag wrote: > Hello GCC, > > I was working on a 32-64 bit porting project and while debugging a > crash I was very surprised to learn that GCC allowed linking of 64 bit > library against 32 bit binary with a warning. > > If the classic "-L" compiler switch is used, GCC barfs out a "Skipping > incompatible xxxx.a" error and doesn't emit any executable. However, > It is interesting to note that if full path of the library is given > instead as part of compiler flag instead of "-L... -l" incantation, > GCC emitted the final executable with a warning. So the question is, > does ELF specification allow interlinking of 32/64 bit obj files ? Why > are the compiler messages different in these two cases ? Why did the > compiler emit the executable in the first place instead of bailing out > ? Those aren't compiler messages, they're linker messages, and the linker is not part of GCC.