lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Well, I have bad news and I have good news.
>
> The bad news is that some library (and I haven't the foggiest which,
> it looks like some Apple framework but I can't tell) is causing the
> linker to spit out a bunch of randomly-named undefined symbol errors
> if I turn dead code stripping off. I tried for several hours to figure
> out how to debug that but I'm completely baffled and I can't find any
> good search terms to google for solutions.
>
> The good news is that I found this:
>
> http://iphone.galloway.me.uk/2011/03/assembly-beware-local-label-names-with-dead_strip-option/
>
> This looks HIGHLY relevant. I'm going to go poke at the LuaJIT source
> code to see if there's anything I can do. Mike, would you like a patch
> if I get this working? Or would you like to do it yourself? I'm up for
> any sort of collaboration if you want to, or I can (try to) do it
> myself.

Okay, I found the problem.

A bunch of symbols got stripped out (such as all of the _lj_BC_*
symbols and some _lj_vm_* symbols) with a handful of nop's appearing
where the symbols and their associated code should have been.

It looks like the dead code detector on Mac just kinda chokes when you
put a symbol in the middle of a function; it strips out everything
until the next unconditional jump. I mean, it's pretty obvious what
you were trying to do in the code there; it makes perfect sense to do
it this way when you're writing assembly code.

Part of me thinks that the "easy" solution would be to put some
artificial references to the mistakenly-stripped symbols somewhere,
but this is where my experience starts to peter out; I know how to do
this with C functions but not with stuff defined in assembly. Ideally
I could just have some sort of definitions file that tells the linker
"these are important, don't strip them no matter what" but I don't
know how to do that. (I'm open for advice!)

/s/ Adam