[llvm-commits] new linux/llvm patches

PaX Team pageexec at freemail.hu
Fri May 11 18:15:50 PDT 2012


hi all,

after more than a year i finally found some time to work on the linux compilation
project, the results of which are summarized below.

1. one important development is that linux can now be compiled with linux-side
   patches only (on x86 at least) as long as you don't want to use integrated-as.

   pax-linux-3.3.5-test11-clang-only.patch was created on top of PaX but i think
   it'll mostly apply to vanilla as well.

   note that i enabled integrated-as (more in this later) so you'll want the
   llvm patches as well if you want to try the linux patch as is.

   i also enabled -fcatch-undefined-behavior for W=1, this will produce a kernel
   that triggers a runtime check in ext4 for me (that i didn't have time to fix
   yet), so be careful.

2. the rest of the patches are for llvm (with the hope that they'll be accepted
   in one form or another eventually ;).

   - elf-emit-R_X86_64_32S.patch: this is a fix for a link-time problem (wrong
     relocation type gets emitted for some insns on amd64), i'm sure there's a
     better way to identify all the affected insns but for now i just used a 
     simple grep you can find in the patch to produce the full list.

   - handle-empty-archive.patch: this is a small fix for LTO to be able to accept
     empty .a archives.

   - kernel-riprel.patch: this patch enables rip-relative addressing on amd64
     even for -mcmodel=kernel (something gcc also does already). this is useful
     for linux when creating a relocatable kernel since it reduces the number of
     relocations and speeds up booting.

   - integrated-as-single-quoted-string.patch: this makes integrated-as accept
     strings enclosed in single quotes (something the GNU as accepts as well).

   - integrated-as-code16gcc.patch
     integrated-as-extern.patch
     integrated-as-ifb.patch
     integrated-as-ifc.patch
     integrated-as-octa.patch
     integrated-as-purgem.patch: these simple patches add support for some new
     directives needed for linux. the only interesting and perhaps controversial
     one is .octa support where i chose to support a very specific use case only
     instead of making MCExpr be fully 128 bit aware (my guess was that it's not
     desirable/worth the effort just for this one directive).

   - integrated-as-macro.patch: this is by far the biggest and most complex patch
     in the series, so let me elaborate on it a bit more. first, the goals i wanted
     to accomplish:

     - support for new macro-like directives: .rept .irp .irpc .endr
     - support for nesting the above directives and .macro as well
     - support for default .macro arguments (in GNU as mode), note that there's
       still no support for keyword arguments and qualifiers such as :req and :vararg
     - support for whitespace separated .macro parameters and arguments (in GNU as mode)
     - a fix when substituting quoted string arguments (quotes weren't omitted)
     - code reuse among all these directives as much as possible

     some problems that i ran into with the implementation:

     - it seems that .macro behaviour mostly models darwin's assembler, not the GNU
       one, and i had to reuse the same hack that PlatformParser has to differentiate
       some behaviour. it'd be nice to have a way to know the target assembler flavour
       in AsmParser. moving code into ELFAsmParser and DarwinAsmParser could be another
       way but that requires more changes to be able to share code due to the way this
       class hierarchy is designed.

     - i took the liberty to introduce a few typedefs to reduce eyestrain on various
       support data structures, i hope that std::vector and std::pair use is acceptable
       here (i'll note though that supporting qualifiers will need std::map or something
       similar, ideas are welcome).

     - more tests are needed for all this (but llvm can at least digest most linux code
       now, maybe that counts for something ;).

   - integrated-as-all.patch: this is a merge of all the above patches plus some whitespace
     fixes that i couldn't be bothered to separate out.

so that's all for now, let me know what you think. note that i won't have much more time
to spend on the llvm side of patches, so i'd also appreciate if someone could take over
in case the review process drags out.

cheers,
  PaX Team

PS: the missing piece to fully enable integrated-as for linux is .code16 and .code16gcc
    support, in case anyone's looking out for a challenge ;).

-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  pax-linux-3.3.5-test11-clang-only.patch
     Date:  12 May 2012, 1:31
     Size:  68258 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pax-linux-3.3.5-test11-clang-only.patch
Type: application/octet-stream
Size: 68258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  elf-emit-R_X86_64_32S.patch
     Date:  11 May 2012, 0:51
     Size:  2609 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf-emit-R_X86_64_32S.patch
Type: application/octet-stream
Size: 2609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0001.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  handle-empty-archive.patch
     Date:  11 May 2012, 0:51
     Size:  668 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: handle-empty-archive.patch
Type: application/octet-stream
Size: 668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0002.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  kernel-riprel.patch
     Date:  11 May 2012, 0:45
     Size:  6791 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel-riprel.patch
Type: application/octet-stream
Size: 6791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0003.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-single-quoted-string.patch
     Date:  11 May 2012, 0:41
     Size:  795 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-single-quoted-string.patch
Type: application/octet-stream
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0004.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-code16gcc.patch
     Date:  11 May 2012, 0:06
     Size:  520 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-code16gcc.patch
Type: application/octet-stream
Size: 520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0005.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-extern.patch
     Date:  11 May 2012, 0:08
     Size:  531 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-extern.patch
Type: application/octet-stream
Size: 531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0006.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-ifb.patch
     Date:  12 May 2012, 0:39
     Size:  1636 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-ifb.patch
Type: application/octet-stream
Size: 1636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0007.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-ifc.patch
     Date:  11 May 2012, 0:13
     Size:  1862 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-ifc.patch
Type: application/octet-stream
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0008.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-octa.patch
     Date:  11 May 2012, 0:01
     Size:  3542 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-octa.patch
Type: application/octet-stream
Size: 3542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0009.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-purgem.patch
     Date:  11 May 2012, 0:07
     Size:  1872 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-purgem.patch
Type: application/octet-stream
Size: 1872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0010.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-macro.patch
     Date:  12 May 2012, 0:43
     Size:  22237 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-macro.patch
Type: application/octet-stream
Size: 22237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0011.obj>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  integrated-as-all.patch
     Date:  11 May 2012, 23:29
     Size:  43524 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated-as-all.patch
Type: application/octet-stream
Size: 43524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120512/8d2c1240/attachment-0012.obj>


More information about the llvm-commits mailing list