15619 Commits

Author SHA1 Message Date
Andrew Kelley
c3148988a3 link.Elf.ZigObject: make resetShdrIndexes non generic 2024-10-11 10:33:54 -07:00
Andrew Kelley
4669269673 link.Elf: fix phdr_gnu_stack_index not included in sortPhdrs
Adds type safety for program header indexes.

Reduce the amount of state sortPhdrs has access to, helping make the
data dependencies clear.
2024-10-11 10:33:54 -07:00
Andrew Kelley
4000685557 Compilation: don't write cache manifest on failure
When errors occurred during flush(), incremental cache mode was still
writing a successful cache manifest, making subsequent compilations fail
because they would get a cache hit only to find invalid data.
2024-10-10 14:21:52 -07:00
Andrew Kelley
14c8e270bb link: fix false positive crtbegin/crtend detection
Embrace the Path abstraction, doing more operations based on directory
handles rather than absolute file paths. Most of the diff noise here
comes from this one.

Fix sorting of crtbegin/crtend atoms. Previously it would look at all
path components for those strings.

Make the C runtime path detection partially a pure function, and move
some logic to glibc.zig where it belongs.
2024-10-10 14:21:52 -07:00
Samuel Fiedler
58349b2c8e arch/aarch64/Mir: fix spelling (pseudo instead of psuedo) 2024-10-10 13:25:52 -07:00
mlugg
c96f9a017a Sema: implement @splat for arrays
Resolves: #20433
2024-10-10 11:22:49 +01:00
Ian Johnson
072e062443 zig fetch: update saved dependency with resolved URL
Closes #21645
2024-10-09 23:55:38 -07:00
Andrew Kelley
2e2927735d
Merge pull request #21629 from ziglang/elf-incr
elf: more incremental progress
2024-10-09 17:43:17 -07:00
Andrew Kelley
5d7ed61103
Merge pull request #21644 from ziglang/macho-issue-21598
link.MachO: fix reporting undefined implicit symbols and fix a typo in InternalObject.addObjcMethnameSection method
2024-10-09 17:31:28 -07:00
Andrew Kelley
c86a334d43 link.Elf.Object.initAtoms: reduce state access and indirection
The initAtoms function now only uses the `elf_file` parameter for
reporting linker error messages, making it easier to see that the
function has no data dependencies other than the Object struct itself,
making it easier to parallelize or otherwise move that logic around.

Also removed an indirect call via `addExtra` since we already know the
atom's file is the current Object instance. All calls to `Atom.addExtra`
should be audited for similar reasons.

Also removed unjustified use of `inline fn`.
2024-10-09 15:40:59 -07:00
Jakub Konka
d43b0cb31f macho: fix a typo in InternalObject.addObjcMethnameSection 2024-10-09 21:39:45 +02:00
Jakub Konka
90aa68cbfc macho: report special symbols if undefined
Special symbols include explictly force undefined symbols passed via -u
flag, missing entry point symbol, missing 'dyld_stub_binder' symbol, or
missing '_objc_msgsend' symbol.
2024-10-09 21:39:44 +02:00
Jakub Konka
73c3b9b8ab elf: revert growing atoms in Dwarf.resize for standard alloc 2024-10-09 12:38:53 -07:00
Jakub Konka
e9d819a29e elf: clean up how we create un-allocated sections 2024-10-09 12:38:53 -07:00
Jakub Konka
e448fb9601 elf: change how we manage debug atoms in Dwarf linker 2024-10-09 12:38:53 -07:00
Jakub Konka
c92c72d08c elf: do not create atoms for section symbols that do not require it 2024-10-09 12:38:53 -07:00
Jakub Konka
ef7bac4aa5 elf: move setting section size back to Elf.growSection 2024-10-09 12:38:53 -07:00
Jakub Konka
3d315f45d8 elf: drastically simplify extracting section size logic 2024-10-09 12:38:53 -07:00
Jakub Konka
0e5cd112ef elf: clear dynamic relocs before resolving relocs in atoms
When resolving and writing atoms to file, we may add dynamic relocs
to the output buffer so clear the buffers before that happens.
2024-10-09 12:38:53 -07:00
Jakub Konka
cf2e462d91 elf: add some extra logging for created dynamic relocs 2024-10-09 12:38:48 -07:00
Jakub Konka
133aa709b0 elf: do not panic if we already have create a PLT entry for a symbol 2024-10-09 12:38:11 -07:00
Jakub Konka
906cf48e14 elf: fix creation of synthetic sections 2024-10-09 12:38:11 -07:00
Jakub Konka
887f9a29f3 elf: combine growAllocSection and growNonAllocSection into growSection 2024-10-09 12:38:11 -07:00
Jakub Konka
0aa24ac2e3 elf: move sections in segments that need moving only 2024-10-09 12:38:11 -07:00
Jakub Konka
9a15c3e1a1 elf: mark objects as dirty/not-dirty
This way we can track if we need to redo the object parsing or not.
2024-10-09 12:38:09 -07:00
Jakub Konka
4604577ae1 elf: use arena for incremental cache 2024-10-09 12:31:04 -07:00
Jakub Konka
bd5fc899db elf: do not re-allocate AtomLists unless dirtied 2024-10-09 12:27:30 -07:00
Jakub Konka
bae3dbffdf elf: clear dynamic relocs before repopulating 2024-10-09 12:27:30 -07:00
Jakub Konka
bc7e0342b5 elf: do not re-populate synthetic sections when updating 2024-10-09 12:27:30 -07:00
Jakub Konka
7fead5d6dd elf: track atoms within AtomList with array hash map 2024-10-09 12:27:30 -07:00
Jacob Young
d748cfc2b7 x86_64: print pseudo instructions in wip_mir log 2024-10-09 07:48:10 -04:00
Jacob Young
c127c06fd7 Dwarf: implement and test lexical blocks 2024-10-09 07:48:09 -04:00
Andrew Kelley
31d70cb1e1 link.Elf: avoid needless file system reads in flush()
flush() must not do anything more than necessary. Determining the type
of input files must be done only once, before flush. Fortunately, we
don't even need any file system accesses to do this since that
information is statically known in most cases, and in the rest of the
cases can be determined by file extension alone.

This commit also updates the nearby code to conform to the convention
for error handling where there is exactly one error code to represent
the fact that error messages have already been emitted. This had the
side effect of improving the error message for a linker script parse
error.

"positionals" is not a linker concept; it is a command line interface
concept. Zig's linker implementation should not mention "positionals".
This commit deletes that array list in favor of directly making function
calls, eliminating that heap allocation during flush().
2024-10-08 18:02:59 -07:00
Andrew Kelley
2c41c453b6 link.Elf: avoid converting rpath data in flush()
The goal is to minimize as much as possible how much logic is inside
flush(). So let's start by moving out obvious stuff. This data can be
preformatted before flush().
2024-10-08 18:02:59 -07:00
Pavel Verigo
4b89a4c7cb stage2-wasm: airRem + airMod for floats 2024-10-08 20:58:15 +02:00
mlugg
95857d6b21
Sema: add missing runtime value validation to global mutable variables
Resolves: #20365
2024-10-07 07:42:17 +01:00
mlugg
36243567e6
Sema: add missing runtime value validation to @memcpy and @memset 2024-10-07 07:27:50 +01:00
Alex Rønne Petersen
7a2fde973d link.Elf: Fix page size calculation for more architectures.
Sourced from binutils/bfd.
2024-10-07 07:04:05 +02:00
Alex Rønne Petersen
790fc8cd98
Merge pull request #21499 from alexrp/loongarch-gnusf
Add `loongarch64-linux-gnusf` target support
2024-10-07 01:24:00 +02:00
Alex Rønne Petersen
ece265b1c2
Merge pull request #21605 from alexrp/ohos-stuff
`std.Target`: Introduce `Abi.ohoseabi` to distinguish the soft float case.
2024-10-06 16:26:24 +02:00
Alex Rønne Petersen
be5378b038
Merge pull request #21587 from alexrp/hexagon-porting
Some initial `hexagon-linux` port work
2024-10-06 13:35:56 +02:00
Alex Rønne Petersen
25ee7b0ea8
compiler: Don't require PIC for aarch64-linux-ohos.
While Clang defaults to PIC for this target, it's not actually required.
2024-10-05 15:19:14 +02:00
Alex Rønne Petersen
09efa95f48
compiler: Don't link to nonexistent libc libraries for ohos. 2024-10-05 15:14:16 +02:00
Alex Rønne Petersen
84e192c88b
std.Target: Introduce Abi.ohoseabi to distinguish the soft float case.
For the same reason as #21504.
2024-10-05 15:13:37 +02:00
Alex Rønne Petersen
d23db9427b
Merge pull request #21574 from alexrp/llvm-sub-arch
`llvm`: Implement sub-architecture translation in `targetTriple()`.
2024-10-05 13:49:05 +02:00
David Rubin
043b1adb8d
remove @fence (#21585)
closes #11650
2024-10-04 22:21:27 +00:00
Felix Queißner
7c74edec8d
Adds new cpu architectures propeller1 and propeller2. (#21563)
* Adds new cpu architectures propeller1 and propeller2.

These cpu architectures allow targeting the Parallax Propeller 1 and Propeller 2, which are both very special microcontrollers with 512 registers and 8 cpu cores.

Resolves #21559

* Adds std.elf.EM.PROPELLER and std.elf.EM.PROPELLER2
* Fixes missing switch prongs in src/codegen/llvm.zig
* Fixes order in std.Target.Arch

---------

Co-authored-by: Felix "xq" Queißner <git@random-projects.net>
2024-10-04 13:53:28 -07:00
Alex Rønne Petersen
eb363bf845
Merge pull request #21572 from alexrp/tests-llvm-targets
`test`: Rewrite the target triple list for `llvm_targets`.
2024-10-04 19:37:12 +02:00
Alex Rønne Petersen
b23a5b56c2
Merge pull request #21578 from alexrp/s390x-porting
Get module tests passing for `s390x-linux` and add it to CI
2024-10-04 14:40:32 +02:00
Alex Rønne Petersen
9b273f6b9a
Merge pull request #21570 from alexrp/windows-itanium
Initial port work for `*-windows-itanium` support.
2024-10-03 21:53:22 +02:00