public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/98778] New: asm() accepts certain "i" (symbol) constructs despite -fpie for x86-64
@ 2021-01-21  9:10 jbeulich at suse dot com
  2021-01-21 11:36 ` [Bug inline-asm/98778] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jbeulich at suse dot com @ 2021-01-21  9:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98778

            Bug ID: 98778
           Summary: asm() accepts certain "i" (symbol) constructs despite
                    -fpie for x86-64
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at suse dot com
  Target Milestone: ---

While in the example below all 3 variants get refused ("impossible constraint")
with -fpic or with "-m32 -fpie", the ones in cases 0 and 2 get accepted with
just -fpie, producing non-position-independent code (or more precisely
unsuitable relocations).

void efn(void);
void(*efp)(void);

void*test(int i) {
        void*res;

        switch(i) {
        case 0:
                asm("mov %1,%0" : "=r" (res) : "i" (test));
                break;
#ifndef __PIE__
        case 1:
                asm("mov %1,%0" : "=r" (res) : "i" (efn));
                break;
#endif
        case 2:
                asm("mov %1,%0" : "=r" (res) : "i" (&efp));
                break;
        default:
                res = (void*)0;
                break;
        }

        return res;
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-14  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21  9:10 [Bug inline-asm/98778] New: asm() accepts certain "i" (symbol) constructs despite -fpie for x86-64 jbeulich at suse dot com
2021-01-21 11:36 ` [Bug inline-asm/98778] " jakub at gcc dot gnu.org
2021-01-21 11:40 ` jakub at gcc dot gnu.org
2021-01-21 12:27 ` jbeulich at suse dot com
2021-09-14  9:37 ` [Bug target/98778] " pinskia 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).