[PATCH] Linking of shared libraries for MIPS little-endian 32-bit target

Simon Atanasyan simon at atanasyan.com
Tue Nov 19 13:05:43 PST 2013



================
Comment at: lib/ReaderWriter/ELF/X86/X86TargetHandler.h:18
@@ -17,3 +17,3 @@
 namespace elf {
-typedef llvm::object::ELFType<llvm::support::little, 2, false> X86ELFType;
+typedef llvm::object::ELFType<llvm::support::little, 4, false> X86ELFType;
 class X86LinkingContext;
----------------
Simon Atanasyan wrote:
> Michael Spencer wrote:
> > This is an unrelated (and incorrect) change.
> OK. I will fix that.
I agree that this change is unrelated but I found rather strange things related to the `X86TargetHandler` class. This class is inherited from the `DefaultTargetHandler` class template which is instantiated using the `X86ELFType` type. The `X86ELFType::MaxAlignment` equals to 2. When we emit an ELF output file for X86 target we use a //writer// class inherited from the `OutputELFWriter<ELFT>` class where `ELFT::MaxAlignment` equals to 4. That is the strange thing number one. The strange thing number two is a constructor of the `OutputELFWriter` class. In this constructor (in case of X86 target) we make a dangerous cast. In fact we cast between different successor of the `TargetHandlerBase` class.

Is it a deliberate decision or mistake?


http://llvm-reviews.chandlerc.com/D2156



More information about the llvm-commits mailing list