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

Report errors for certain unknown section types #1215

Closed
MaskRay opened this issue Mar 11, 2024 · 0 comments
Closed

Report errors for certain unknown section types #1215

MaskRay opened this issue Mar 11, 2024 · 0 comments

Comments

@MaskRay
Copy link

MaskRay commented Mar 11, 2024

See also llvm/llvm-project#84812

From https://maskray.me/blog/2024-03-09-a-compact-relocation-format-for-elf#linker-notes

GNU ld allows certain unknown section types:

  • [SHT_LOUSER,SHT_HIUSER] and non-SHF_ALLOC
  • [SHT_LOOS,SHT_HIOS] and non-SHF_OS_NONCONFORMING

but reports errors and stops linking for others (unless --no-warn-mismatch is specified).
When linking a relocatable file using SHT_RELLEB, you might encounter errors like the following:

% clang -mrelleb -fuse-ld=bfd a.c b.c
/usr/bin/ld.bfd: unknown architecture of input file `/tmp/a-1e0778.o' is incompatible with i386:x86-64 output
/usr/bin/ld.bfd: unknown architecture of input file `/tmp/b-9963f0.o' is incompatible with i386:x86-64 output
/usr/bin/ld.bfd: error in /tmp/a-1e0778.o(.eh_frame); no .eh_frame_hdr table will be created
/usr/bin/ld.bfd: error in /tmp/b-9963f0.o(.eh_frame); no .eh_frame_hdr table will be created
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have a prototype for a new relocation format (RELLEB). Linking a.o and b.o with unpatched gold, lld, and mold create an output file with unrelocated .text and will crash at run-time.

@rui314 rui314 closed this as completed in d21207c Mar 12, 2024
This issue was closed.
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