Re: [LLVMdev] clang .code16 with -Os producing larger code that it needs to

2015-02-24 Thread Craig Topper
Does gas really relax from 16-bit addresses to 32-bit address as necessary? I played around briefly and it looks like gas will only emit 16-bit addresses in 16-bit mode unless addr32 is prefixed. Even for an external symbol it only emitted a 16-bit relocation type until I added addr32. I wonder if

Re: [LLVMdev] clang .code16 with -Os producing larger code that it needs to

2015-02-24 Thread David Woodhouse
On Tue, 2015-02-24 at 00:42 -0800, Craig Topper wrote: > Does gas really relax from 16-bit addresses to 32-bit address as > necessary? I played around briefly and it looks like gas will only > emit 16-bit addresses in 16-bit mode unless addr32 is prefixed. Even > for an external symbol it only emit

Re: [LLVMdev] clang .code16 with -Os producing larger code that it needs to

2015-02-23 Thread David Woodhouse
On Fri, 2015-02-20 at 13:47 -0500, Rafael Espíndola wrote: > > Your task, should you choose to accept it, is to make it cope with other > > forms of relaxation where necessary. > > And if not, please open a bug :-) http://llvm.org/bugs/show_bug.cgi?id=22662 FWIW I could reproduce the 'movl foo,

Re: [LLVMdev] clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread Rafael Espíndola
> Your task, should you choose to accept it, is to make it cope with other > forms of relaxation where necessary. And if not, please open a bug :-) There are a few other missing cases that cause MC to produce code that is more "relaxed" than it needs to be. Cheers, Rafael __

Re: clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread David Woodhouse
On Fri, 2015-02-20 at 16:46 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > > All labels are local to the source file. If I use %eax instead of %ebx > in first example I get the short code. For the second example how does > clang detect that offset fits into one byte for issuing EB XX sequen

Re: clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread David Woodhouse
On Fri, 2015-02-20 at 16:05 +, David Woodhouse wrote: > > It's been a while since I looked at this... but I think for the short > jumps we just emit the 8-bit version and there's a fixup which can go > back and re-emit the instruction in 32-bit mode if it finds it doesn't > fit? > > Do we jus

Re: clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread David Woodhouse
On Fri, 2015-02-20 at 15:58 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > When experimenting with compiling GRUB2 with clang using integrated as, > I found out that it generates a 16-bit code bigger than gas counterpart > and result gets too big for size constraints of bootsector. This was

Re: clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 20.02.2015 16:38, David Woodhouse wrote: > On Fri, 2015-02-20 at 15:58 +0100, Vladimir 'φ-coder/phcoder' Serbinenko > wrote: >> When experimenting with compiling GRUB2 with clang using integrated as, >> I found out that it generates a 16-bit code bigger than gas counterpart >> and result gets to

Re: clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 20.02.2015 15:58, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > When experimenting with compiling GRUB2 with clang using integrated as, > I found out that it generates a 16-bit code bigger than gas counterpart > and result gets too big for size constraints of bootsector. This was > traced mainl

clang .code16 with -Os producing larger code that it needs to

2015-02-20 Thread Vladimir 'φ-coder/phcoder' Serbinenko
When experimenting with compiling GRUB2 with clang using integrated as, I found out that it generates a 16-bit code bigger than gas counterpart and result gets too big for size constraints of bootsector. This was traced mainly to 2 problems. 32-bit access to 16-bit addresses. source: movl