-
Notifications
You must be signed in to change notification settings - Fork 15
Description
I'm not sure if this is actually new, but it's the first time I've seen it: https://lore.kernel.org/all/202506290255.KBVM83vZ-lkp@intel.com/
ld.lld: error: Function Import: link error: linking module flags 'Code Model': IDs have conflicting values: 'i32 3' from vmlinux.a(init.o at 899876), and 'i32 1' from vmlinux.a(net-traces.o at 1014596)
IMO this shouldn't be a link error. There's a comment saying
// Linking object files with different code models is undefined behavior
// because the compiler would have to generate additional code (to span
// longer jumps) if a larger code model is used with a smaller one.
// Therefore we will treat attempts to mix code models as an error.
but I don't agree with that. The code model determines which relocations should be emitted, there's easily definable behavior if all those relocations can be resolved (just link it and it runs fine) and if any of those relocations can't be resolved (emit a truncation error). That's the same behavior regardless of mixing code models, I don't see any object-wide behavior related to which code model is used. So I don't see where the UB creeps in.
That said, as far as I can tell this has been there since 2018 and we're just starting to see the errors now. I'd also expect this to trip up all over the place, so not sure what I'm missing.