freenode/#clasp - IRC Chatlog
Search
2:16:33
drmeister
You don't need constructors to be external linkage - because they are in a special table in the .ll file.
2:17:08
Bike
according to the manual on my linux machine, lowercase means local "usually", and uppercase means global
2:18:44
drmeister
Is there a way to get more information on the linkage type of the symbol. These 't' and 'T' are like 1970's unix
2:19:38
drmeister
I think there must be - because in this example there isn't a collision between __ZN6ExposeC1Ev even though they are external from both foo.o and bar.o.
2:20:40
drmeister
If I remove static from static int zzz() I get a collision and the symbols go from 't' to 'T' in the nm output - just like __ZN6ExposeC1Ev and __ZN6ExposeC2Ev are at the beginning. That makes me thing there are different kinds of 'T' symbols.
2:33:06
drmeister
No - they have to have the same calling signature - they are all static constructors.
2:33:07
drmeister
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 9, void ()* @CLASP-CTOR_36, i8* null }]
2:33:37
Bike
i mean each file has a different constructor, and all of those constructors need to be called.
2:34:31
Bike
odr is like when you have the same function in multiple .cc since it's a template instantiation or something.
2:34:37
drmeister
The linking needs to put them into the list of static constructors in the right order - here we are hoping that the linker does the right thing.
2:35:57
drmeister
I hope (HOPE!) the linker sets up the constructors to be called in the order they appear in the linker command line.
2:42:00
drmeister
Another idea is to export all of these functions as linkonce_odr and not put them in the llvm.global_ctors variable in each object file.
2:42:49
Bike
yeah that sounds safer. though i don't know about the linkonce_odr thing. we could just give them different names, couldn't we?
2:45:46
drmeister
https://github.com/clasp-developers/clasp/blob/dev/src/lisp/kernel/cmp/cmpintrinsics.lsp#L800
3:22:31
drmeister
That's converted from the llvm symbol LinkOnceODRLinkage. There is a dash between every transition from lowercase to uppercase.
3:23:08
drmeister
I wish I'd made it a bit more intelligent so that a string of uppercase followed by lowercase like FOOBar got translated to foo-bar.
3:24:28
drmeister
Bike: I think I'll ask you if you can refactor the make-boot-function-global-variable function and add-global-ctor-function so that.
3:25:28
drmeister
and compile-file-parallel probably calls add-global-ctor-function directly and accumulates the names of ctor functions...
3:26:11
drmeister
so that compile-file-parallel can compile a function that calls all the ctors in sorted order.
3:26:46
drmeister
They won't be ctors anymore - they will be regular functions that look like ctors for simplicity. The function that calls them all will become the only global ctor.
3:27:58
drmeister
All I'm going to try to determine tonight is if by making these ctors link-once-odrlinkage - if that creates entries in the debug-map of the fasl.
3:28:22
drmeister
We may get luck and the linker may also order the ctors properly, but I agree with you, I don't want to depend on that.
3:42:35
drmeister
I'm linking everything together here to create the bclasp fasl file. The external linkage is probably screwing that up.
4:20:25
drmeister
We accumulate the names of the ctor function in each module and then compile a module that just contains a bunch of declarations of those ctor functions and a llvm.global_ctors global variable that lists them all in order.
13:27:15
drmeister
::notify Bike can you look up how to build ld64 on macOS? I don’t see another way to figure out why object files aren’t being added to the debug map. In the ld64 docs and comments it calls the debug map “debug notes”.