llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.42k stars 11.74k forks source link

PIC is broken on ppc32-linux #4665

Closed llvmbot closed 2 years ago

llvmbot commented 15 years ago
Bugzilla Link 4293
Resolution FIXED
Resolved on Jul 18, 2014 18:35
Version trunk
OS Linux
Attachments testcase
Reporter LLVM Bugzilla Contributor
CC @asl,@chmeeedalf

Extended Description

This is the source of the one "make check" failure on ppc32-linux. Bugpoint runs llc -relocation-model=pic and that breaks the reduction of test/BugPoint/misopt-basictest.ll.

$ Debug/bin/llc -reloaction-model=pic x.bc -f -o x.s $ gcc x.s -o x.exe x.s: Assembler messages: x.s:14: Error: bad expression x.s:14: Error: syntax error; found L' but expected,' x.s:14: Error: junk at end of line: L1$pb"@ha' x.s:14: Error: bad expression x.s:14: Error: syntax error; foundL' but expected (' x.s:14: Error: junk at end of line:L1$pb"@l(3)'

The problem is these: lis 3, .LC0-"L1$pb"@ha la 3, .LC0-"L1$pb"@l(3) which probably would work fine if only "L1$pb" were defined anywhere in the .s file.

By contrast the .s generated by gcc -fPIC looks like:

[...] .section ".got2","aw" .LCTOC1 = .+32768 .section ".text" .section ".got2","aw" .LC1: .long .LC0 [... later on in main] addis 30,30,.LCTOC1-.LCF0@ha addi 30,30,.LCTOC1-.LCF0@l lwz 3,.LC1-.LCTOC1(30) bl puts+32768@plt [... def'n of .LC0 same as llvm's .s]

or with gcc -fpic:

[... no def'n of .LCTOC1 or .LC1] addis 30,30,_GLOBAL_OFFSETTABLE-.LCF0@ha addi 30,30,_GLOBAL_OFFSETTABLE-.LCF0@l lwz 3,.LC0@got(30) bl puts@plt [... def'n of .LC0 below]

llvmbot commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#4300

chmeeedalf commented 10 years ago

Hal committed this in r213427 (fixed patch).

chmeeedalf commented 10 years ago

PIC Patch under review This patch is currently under review, posted to llvm-commits. It adds complete -fPIC (not -fpic) support for 32-bit PowerPC SVR4.

chmeeedalf commented 10 years ago

I'm willing to help anyone with this. Unfortunately I don't have the time or the llvm knowledge to complete it all myself, but I can assist.

llvmbot commented 11 years ago

Is anyone looking into adding PIC support for 32-bit PowerPC? AFAIK this is the last major piece left for being able to utilize LLVM on OpenBSD.

chmeeedalf commented 12 years ago

Anyone know if this is also failing on darwin? freebsd?

When I tried on FreeBSD a few months ago, PIC was completely nonexistent on PowerPC, and it doesn't look like any progress has been made, at least publicly. rdivacky had sketched out a plan, but ran out of time.

llvmbot commented 12 years ago

Anyone know if this is also failing on darwin? freebsd?

llvmbot commented 15 years ago

Not yet, it's on my TODO list though :)

llvmbot commented 15 years ago

Tilmann, are you working on this for the GSoC? Any progress?

llvmbot commented 15 years ago

Bug llvm/llvm-bugzilla-archive#4300 has been marked as a duplicate of this bug.

llvmbot commented 15 years ago

assigned to @chmeeedalf