Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wl,--pie rejected by all linkers except Wild #101

Open
marxin opened this issue Sep 2, 2024 · 0 comments
Open

-Wl,--pie rejected by all linkers except Wild #101

marxin opened this issue Sep 2, 2024 · 0 comments

Comments

@marxin
Copy link
Contributor

marxin commented Sep 2, 2024

I noticed the following is rejected:

int main()
{
  return 0;
}
❯ gcc main.c -fpie -Wl,--pie -B ~/Programming/wild && ./a.out 
Segmentation fault (core dumped)
❯ gcc main.c -fpie -Wl,--pie
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a PIE object
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
❯ gcc main.c -fpie -Wl,--pie -fuse-ld=mold
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32 relocation at offset 0x1 against symbol `__TMC_END__' can not be used; recompile with -fPIC
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32S relocation at offset 0x7 against symbol `.tm_clone_table' can not be used; recompile with -fPIC
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32 relocation at offset 0x18 against symbol `.tm_clone_table' can not be used; recompile with -fPIC
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32 relocation at offset 0x31 against symbol `__TMC_END__' can not be used; recompile with -fPIC
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32S relocation at offset 0x38 against symbol `.tm_clone_table' can not be used; recompile with -fPIC
mold: error: /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text): R_X86_64_32 relocation at offset 0x5a against symbol `.tm_clone_table' can not be used; recompile with -fPIC
collect2: error: ld returned 1 exit status
❯ gcc main.c -fpie -Wl,--pie -fuse-ld=lld
ld.lld: error: relocation R_X86_64_32 cannot be used against symbol '__TMC_END__'; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtend.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x1)

ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x7)

ld.lld: error: relocation R_X86_64_32 cannot be used against symbol '_ITM_deregisterTMCloneTable'; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0xE)

ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x18)

ld.lld: error: relocation R_X86_64_32 cannot be used against symbol '__TMC_END__'; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtend.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x31)

ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x38)

ld.lld: error: relocation R_X86_64_32 cannot be used against symbol '_ITM_registerTMCloneTable'; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x50)

ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o
>>> referenced by crtstuff.c
>>>               /usr/lib64/gcc/x86_64-suse-linux/14/crtbegin.o:(.text+0x5A)
collect2: error: ld returned 1 exit status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant