This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

inline-asm/10386: Passing fct ptr to inline asm not PIC-safe


>Number:         10386
>Category:       inline-asm
>Synopsis:       Passing fct ptr to inline asm not PIC-safe
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 12 08:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Drepper
>Release:        gcc version 3.3 20030412 (prerelease)
>Organization:
>Environment:
Linux/x86-64
>Description:
Using a function pointer as a asm parameter in PIC code fails if the asm parameter format includes "i".  In this case the compiler generates an immediate parameter which it should, since the actual format is "ir", use a register and compute the value in a position independent way.
>How-To-Repeat:
Compile the attached file with

  gcc33 -shared -fPIC -o u.so -O2 -g u.c

The result is

/usr/bin/ld: /tmp/ccYnmTnc.o: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC
/tmp/ccYnmTnc.o: could not read symbols: Bad value


since the generated code is

        movq $foo, %rax
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="hammer-asm.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="hammer-asm.c"

c3RhdGljIHZvaWQgZm9vICh2b2lkKSB7IH0Kdm9pZCBiYXIgKHZvaWQpCnsKICBhc20gKCJtb3Zx
ICUwLCAlJXJheCIgOjogImlyIiAoZm9vKSk7Cn0K


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]