To follow up - I think it's that sb-xc magic plays badly with def!constant magic.
The host knows that sb-xc:lambda-list-keywords is constant, but the xc itself doesn't.

Within a debug break during cross-compilation, in the SB!C package:

(sb-int:info :variable :kind 'cl::lambda-list-keywords) => :CONSTANT ; had better be!
(sb-int:info :variable :kind 'sb-xc::lambda-list-keywords) => :CONSTANT ; sane, at least
(sb!int:info :variable :kind 'sb-xc::lambda-list-keywords) => : UNKNOWN ; << wrong
(sb!int:info :variable :kind 'cl::lambda-list-keywords) :UNKNOWN ; don't care

On Wed, Apr 9, 2014 at 11:15 AM, Douglas Katzman <> wrote:
While tweaking the new load-time tls-index assignment on x86-64, I wanted to compile-time assign indices to all externals in package "CL" so that reader/printer controls can just use [R12+const] to access them (plus of course the check for no-tls-value...). At present it only emits shorter code for SYMBOL-VALUE if it knows that a symbol was ever an operand of the BIND vop. This avoids pollution of the TLS space.
e.g. our favorite Lisp application defines more global special vars than there is TLS space - style issues notwithstanding, such as using defvar when we meant defglobal.

Using the newer code (not committed) I noticed that LAMBDA-LIST-KEYWORDS and MOST-{NEGATIVE/POSITIVE}-{SINGLE/DOUBLE}-FLOAT get tls indices and it seems not to be my bug, which is to say, I assign an index only if a "CL:" symbol is ever, during cross-compilation, an operand of the SYMBOL-VALUE vop.
Thus I infer that the xc doesn't know that those are constants because that would have been dealt with in IR1.

Bottom line: there's definitely something very fishy about how we set up SB-XC symbols that shadow the ones in CL.

If it's a globaldb bug, then I guess, in a strange sort of way, that still makes it my problem....

Fwiw, the target compiler obviously knows about the real constants:
(disassemble '(lambda ()(foo lambda-list-keywords)))
; disassembly for (LAMBDA ())
; Size: 31 bytes. Origin: # x10037AE9E4
; 9E4:       488B159DFFFFFF   MOV RDX, [RIP-99]               ; '(&ALLOW-OTHER-KEYS &AUX &BODY
                                                              ;   &ENVIRONMENT ...)
                                                              ; no-arg-parsing entry point
; 9EB:       488B059EFFFFFF   MOV RAX, [RIP-98]               ; #<FDEFINITION object for FOO>

(disassemble '(lambda ()(foo most-negative-short-float)))
; Size: 31 bytes. Origin: # x10037DE0D4
; D4: 488B159DFFFFFF MOV RDX, [rip-99]; -3.4028235e38
                                                              ; no-arg-parsing entry point
; DB:       488B059EFFFFFF   MOV RAX, [RIP-98]                ; #<FDEFINITION object for FOO>