public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
@ 2020-10-17 12:53 slyfox at gcc dot gnu.org
2020-10-17 12:55 ` [Bug driver/97469] " slyfox at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: slyfox at gcc dot gnu.org @ 2020-10-17 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
Bug ID: 97469
Summary: __attribute__ ((__target__ ("..."))) resets -mcmodel=
values, breaks grub compilation
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Bug initially observed as a build failure on grub-2.04. There 32-bit PLT
relocations get generated against external unresolved symbols when
zstd_decompress.c is compiled in -mcmode=large mode.
The trigger seems to be '__attribute__((__target__("bmi2")))' that throws away
'-mcmode=large' commandline flag.
Here is the minimal example extracted (gcc-10 generates correct 'movabs/call
%reg' code, gcc-11 generates incorrect 'call <symbol>' code):
$ bash -x ./mk.bash
+ args=(-O1 -fno-asynchronous-unwind-tables -fno-ident -mcmodel=large -fno-PIE)
+ cat a.c
// grub builds zstd_decompress.c (zstd.module) in -mcmodel=large
// (and -freestanding) mode. grub assumes there will be no dynamic
// PLT relocations. grub_memmove() is symbol external (dynamic)
// to zstd.module.
extern void grub_memmove(void);
__attribute__((__target__("bmi2"))) void a_bmi(void) {
// expect:
// movabsq $grub_memmove, %rbx
// call *%rbx
// actual (bug):
// call grub_memmove
for (;;)
grub_memmove();
}
void a_nobmi(void) {
// expect/actual:
// movabsq $grub_memmove, %rbx
// call *%rbx
for (;;)
grub_memmove();
}
+ gcc-10.2.0 -O1 -fno-asynchronous-unwind-tables -fno-ident -mcmodel=large
-fno-PIE -S a.c
+ cat a.s
.file "a.c"
.text
.globl a_bmi
.type a_bmi, @function
a_bmi:
pushq %rbx
movabsq $grub_memmove, %rbx
.L2:
call *%rbx
jmp .L2
.size a_bmi, .-a_bmi
.globl a_nobmi
.type a_nobmi, @function
a_nobmi:
pushq %rbx
movabsq $grub_memmove, %rbx
.L5:
call *%rbx
jmp .L5
.size a_nobmi, .-a_nobmi
.section .note.GNU-stack,"",@progbits
+ gcc-11.0.0 -O1 -fno-asynchronous-unwind-tables -fno-ident -mcmodel=large
-fno-PIE -S a.c
+ cat a.s
.file "a.c"
.text
.globl a_bmi
.type a_bmi, @function
a_bmi:
subq $8, %rsp
.L2:
call grub_memmove
jmp .L2
.size a_bmi, .-a_bmi
.globl a_nobmi
.type a_nobmi, @function
a_nobmi:
pushq %rbx
movabsq $grub_memmove, %rbx
.L5:
call *%rbx
jmp .L5
.size a_nobmi, .-a_nobmi
.section .note.GNU-stack,"",@progbits
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug driver/97469] __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
@ 2020-10-17 12:55 ` slyfox at gcc dot gnu.org
2020-10-19 7:23 ` [Bug driver/97469] [11 Regression] " marxin at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: slyfox at gcc dot gnu.org @ 2020-10-17 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
--- Comment #1 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Reading
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
it's not very clear if __attribute__((__target__("..."))) should throw away all
existing -m* command line options or should appends to existing ones.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug driver/97469] [11 Regression] __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
2020-10-17 12:55 ` [Bug driver/97469] " slyfox at gcc dot gnu.org
@ 2020-10-19 7:23 ` marxin at gcc dot gnu.org
2020-10-19 7:28 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-19 7:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-10-19
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org
CC| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I'll take a look, we have similar issues with __target__ and __optimize__
attributes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug driver/97469] [11 Regression] __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
2020-10-17 12:55 ` [Bug driver/97469] " slyfox at gcc dot gnu.org
2020-10-19 7:23 ` [Bug driver/97469] [11 Regression] " marxin at gcc dot gnu.org
@ 2020-10-19 7:28 ` rguenth at gcc dot gnu.org
2020-10-19 7:30 ` [Bug target/97469] " jakub at gcc dot gnu.org
2021-01-08 11:32 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-19 7:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Priority|P3 |P1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/97469] [11 Regression] __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2020-10-19 7:28 ` rguenth at gcc dot gnu.org
@ 2020-10-19 7:30 ` jakub at gcc dot gnu.org
2021-01-08 11:32 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-19 7:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Component|driver |target
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with my r11-3183-gba948b37768c99cd8eb9f5b6fbd45fcf4bd15b78
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/97469] [11 Regression] __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2020-10-19 7:30 ` [Bug target/97469] " jakub at gcc dot gnu.org
@ 2021-01-08 11:32 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-08 11:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97469
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Sorry for forgetting about this.
*** This bug has been marked as a duplicate of bug 98585 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-08 11:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-17 12:53 [Bug driver/97469] New: __attribute__ ((__target__ ("..."))) resets -mcmodel= values, breaks grub compilation slyfox at gcc dot gnu.org
2020-10-17 12:55 ` [Bug driver/97469] " slyfox at gcc dot gnu.org
2020-10-19 7:23 ` [Bug driver/97469] [11 Regression] " marxin at gcc dot gnu.org
2020-10-19 7:28 ` rguenth at gcc dot gnu.org
2020-10-19 7:30 ` [Bug target/97469] " jakub at gcc dot gnu.org
2021-01-08 11:32 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).