[llvm-commits] External weak linkage patches for review

Chris Lattner clattner at apple.com
Mon Nov 27 14:22:24 PST 2006


On Nov 25, 2006, at 5:44 PM, Anton Korobeynikov wrote:
> Hello, Everyone.
>
> Please find patches for LLVM & llvm-gcc4 which enables external weak
> linkage. This is just first "draft".

The patch looks good.  Please change these asserts:

+      case GlobalValue::ExternalWeakLinkage:
+       if (Subtarget->isTargetDarwin()) {
+         assert(0 && "FIXME");
+       } else if (Subtarget->isTargetCygwin()) {
+         assert(0 && "FIXME");
+       } else {
+         O << "\t.weak " << name << "\n";
+         break;
+       }

to be more descriptive (e.g. "FIXME: extern weak not supported yet"  
or something).

> Know issues:
>
> 1. There is some "FIXME" in the llvm-backend.cpp connected with  
> external
> weak linkage. It seems to be somehow "old". Don't know, what should be
> done with it.

This code:

#if 0
     // FIXME: When we support external weak globals, this is where  
we do it.
     x = gen_rtx_SYMBOL_REF(Pmode, name);
     SYMBOL_REF_WEAK(x) = DECL_WEAK(decl);
#endif

... should just be removed.

> 2. FIXME's in backend code: Darwin & Mingw32 codegens should be
> implemented

This can be implemented after the first part goes in.

> 3. Linker & ExecutionEngine wasn't touched. TBD later.

The linker part at least should be implemented before this goes in.

> 4. Fixed somehow ELFWriter.cpp. It should be finished. The same  
> applies
> to MachOWriter.cpp. Unfortunately, I don't know this code well to  
> finish
> it.

Don't worry about either of these, they are both unfinished in many  
other respects.

Also, I believe there is a mention in the llvm-gcc/README.LLVM that  
talks about disabling threads on linux to work around this problem.   
Please check to see that it is not needed anymore and remove it if so.

Once the linker part is implemented, go ahead and commit, thanks!

-Chris



More information about the llvm-commits mailing list