Merge remote-tracking branch 'origin/master'
gas: emit GNU-stack note so that stack is not executable
GNU ld uses the presence of these notes to determine the flags of
the final GNU_STACK program header. If they are present in every
object, then the resulting executable's GNU_STACK uses flags RW
instead of RWE.
Reported by Érico Nogueira Rolim.
fold: zero-initialize padding bits of constants
Otherwise, if a constant is stored as a float and retrieved as an
int, the padding bits are uninitialized. This can result in the
generation of invalid assembly:
Error: suffix or operands invalid for `cvtsi2ss'
Reported by Hiltjo Posthuma.
fold: zero-initialize padding bits of constants
Otherwise, if a constant is stored as a float and retrieved as an
int, the padding bits are uninitialized. This can result in the
generation of invalid assembly:
Error: suffix or operands invalid for `cvtsi2ss'
Reported by Hiltjo Posthuma.
add data section "section" $name = ...
This allows you to explicitly specify the section to emit the data
directive for, allowing for sections other than .data: for example, .bss
or .init_array.
Merge remote-tracking branch 'origin/master' into master
fix a typo in call's BNF
Thanks to Jakob for pointing this out.
amd64: Use member class for aggregate parameter temporary
Otherwise, we may end up using an integer and floating class for the
same register, triggering an assertion failure:
qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed.
Test case:
type :T = { s }
export
function $d(:T %.1, s %.2) {
@start
call $c(s %.2)
ret
}
rega: Fix allocation of multiple temporaries to the same register
arm64: Make sure SP stays aligned by 16
According to the ARMv8 overview document
However if SP is used as the base register then the value of the stack
pointer prior to adding any offset must be quadword (16 byte) aligned,
or else a stack alignment exception will be generated.
This manifests as a bus error on my system.
To resolve this, just save registers two at a time with stp.
Move NPred in parse.c and decrease it
This now only limits the number of arguments when parsing the input SSA,
which is usually a small fixed size (depending on the frontend).
Use a dynamic array for phi arguments
Merge remote-tracking branch 'origin/master'
copy: Fix use of compound literal outside its scope
C99 6.5.2.5p6:
> If the compound literal occurs outside the body of a function,
> the object has static storage duration; otherwise, it has automatic
> storage duration associated with the enclosing block.
So, we can't use the address of a compound literal here. Instead,
just set p to NULL, and make the loop conditional on p being non-NULL.
Remarks from Quentin:
I made a cosmetic change to Michael's
original patch and merely pushed the
literal at toplevel.
amd64: Use member class for aggregate parameter temporary
Otherwise, we may end up using an integer and floating class for the
same register, triggering an assertion failure:
qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed.
Test case:
type :T = { s }
export
function $d(:T %.1, s %.2) {
@start
call $c(s %.2)
ret
}
minic: fix undefined symbol linkage issue
The mandel example uses SDL2 for graphics
output. When GCC is used to assemble the
resulting *.s file it shows linker's
errors about undefined symbols from the
library.
This behavior can be fixed by moving
the flags passed to the compiler after
the source file name.
fold: Don't fold invalid addition/subtraction rather than failing
This may happen in a branch QBE doesn't realize is unreachable,
for example (simplified from real code found in ncurses)
data $str = { b "abcdef", b 0 }
function l $f(w %x) {
@start
%.1 =w ceqw %x, 0
jnz %.1, @logic_join, @logic_right
@logic_right
%p =l call $strchr(l $str, w %x)
%.2 =w ceql %p, 0
@logic_join
%.3 =w phi @start %.1, @logic_right %.2
jnz %.3, @fail, @return
@fail
ret 0
@return
%.4 =l sub %p, $str
ret %.4
}
fold: Prevent error when address is used as operand
amd64: Fix floating-point equality check with NaN
arm64 does not have the same issue, and the added test passes there
as well.
Merge remote-tracking branch 'origin/master'