Output absolute symbols in DMD

Jacob Carlborg doob at me.com
Thu May 30 06:25:53 PDT 2013


I'm doing some modifications to DMD where some symbols need to match 
what Clang outputs. I'm trying to figure out how to output absolute and 
lazy symbols. Running "nm -m" on the object file compiled with Clang 
results in this:

00000000 (absolute) external [no dead strip] .objc_class_name_Foo
          (undefined [lazy bound]) external [no dead strip] 
.objc_class_name_NSObject

Foo is defined in the object file and NSObject is externally defined. I 
had a look at the LLVM source code how these symbols are outputted. LLVM 
uses file scope inline assembly for these symbols. The assembly Clang 
generates look like this:

.section	__TEXT,__text,regular,pure_instructions
                                   ## Start of file scope inline assembly
.objc_class_name_Foo=0
.globl .objc_class_name_Foo
.lazy_reference .objc_class_name_NSObject
.lazy_reference .objc_class_name_Foo

                                    ## End of file scope inline assembly

The above code is the top of the assembly file.

Does anyone know how to generate the same symbols in DMD?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list