Bug 102625 - [meta-bug] -mcmodel=large can't link
Summary: [meta-bug] -mcmodel=large can't link
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: meta-bug
Depends on: 79497 98693 95620
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-06 00:09 UTC by H.J. Lu
Modified: 2021-10-19 09:26 UTC (History)
2 users (show)

See Also:
Host:
Target: x86-64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-10-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2021-10-06 00:09:08 UTC
[hjl@gnu-cfl-2 tmp]$ cat l.c
#include <stdio.h>

char foo[0x100000000] = { 1 };

int
main ()
{
  printf ("%p\n", foo);
  return 0;
}
[hjl@gnu-cfl-2 tmp]$ gcc l.c -mcmodel=large
/usr/lib/gcc/x86_64-redhat-linux/11/crtbegin.o: in function `deregister_tm_clones':
crtstuff.c:(.text+0x1): relocation truncated to fit: R_X86_64_32 against symbol `__TMC_END__' defined in .data section in a.out
crtstuff.c:(.text+0x7): relocation truncated to fit: R_X86_64_32S against `.tm_clone_table'
crtstuff.c:(.text+0x18): relocation truncated to fit: R_X86_64_32 against `.tm_clone_table'
/usr/lib/gcc/x86_64-redhat-linux/11/crtbegin.o: in function `register_tm_clones':
crtstuff.c:(.text+0x31): relocation truncated to fit: R_X86_64_32 against symbol `__TMC_END__' defined in .data section in a.out
crtstuff.c:(.text+0x38): relocation truncated to fit: R_X86_64_32S against `.tm_clone_table'
crtstuff.c:(.text+0x5a): relocation truncated to fit: R_X86_64_32 against `.tm_clone_table'
/usr/lib/gcc/x86_64-redhat-linux/11/crtbegin.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against `.bss'
crtstuff.c:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status
[hjl@gnu-cfl-2 tmp]$
Comment 1 H.J. Lu 2021-10-06 12:51:55 UTC
1. Need large model crtbegin*.o and crtend*.o.
2. Need large mode libgcc.a, libgcc_eh.a and libgcov.a.
3. Need large mode lib*.a if we want to link with lib*.a
4. Need the large model libc.a if we want to support large model static
executable.
Comment 2 Florian Weimer 2021-10-19 09:26:46 UTC
libc_nonshared.a and crt1.o from glibc need build changes even for dynamic linking.