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

More symbols included in the 0.12.0 compared to 0.11.0 for ARM Cortex M #20021

Open
MrOneTwo opened this issue May 21, 2024 · 0 comments
Open
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@MrOneTwo
Copy link
Sponsor

Zig Version

0.12.0

Steps to Reproduce and Observed Behavior

I'm building an app for Cortex M from scratch. I'm able to build it on Zig 0.11.0. For 0.12.0 the sections don't fit in the RAM and ROM spaces. There's definitely difference on what symbols are included in the compilation.

Error message I'm seeing:

+- install generated to zig_pill.bin
   +- objcopy generated
      +- zig build-exe zig_pill Debug thumb-freestanding-eabihf 6 errors
error: ld.lld: section '.text' will not fit in region 'rom': overflowed by 15192 bytes
error: ld.lld: section '.preinit_array' will not fit in region 'rom': overflowed by 15192 bytes
error: ld.lld: section '.init_array' will not fit in region 'rom': overflowed by 15192 bytes
error: ld.lld: section '.fini_array' will not fit in region 'rom': overflowed by 15192 bytes
error: ld.lld: section '.ARM.exidx' will not fit in region 'rom': overflowed by 15672 bytes
error: ld.lld: section '.data' will not fit in region 'rom': overflowed by 16320 bytes

I'm using this command to build the object file:

zig build-obj -target thumb-freestanding-eabihf -ofmt=elf src/main.zig --script src/memory.ld

On 0.11.0 I run nm main.o and see:

00000dda t $d.1
00000000 t $t.0
00000dde t $t.2
         U __aeabi_memclr
         U __aeabi_memcpy
         U __aeabi_memset
         U __aeabi_uidiv
         U __aeabi_uidivmod
         U _bss
         U _bss_size
00000058 r builtin.cpu
00000215 t builtin.default_panic
00000010 b builtin.os
00000085 r builtin.output_mode
000002b0 r builtin.panic_messages.cast_truncated_data
000000b7 r builtin.panic_messages.cast_truncated_data__anon_1932
0000024c r builtin.panic_messages.corrupt_switch
0000004a r builtin.panic_messages.corrupt_switch__anon_1383
000002b4 r builtin.panic_messages.divide_by_zero
000000d3 r builtin.panic_messages.divide_by_zero__anon_1933
000001ec r builtin.panic_messages.integer_overflow
00000011 r builtin.panic_messages.integer_overflow__anon_1148
00000248 r builtin.panic_messages.memcpy_alias
00000032 r builtin.panic_messages.memcpy_alias__anon_1382
000002bc r builtin.panic_messages.memcpy_len_mismatch
000001ca r builtin.panic_messages.memcpy_len_mismatch__anon_2023
000002c0 r builtin.panic_messages.shift_rhs_too_big
000001f3 r builtin.panic_messages.shift_rhs_too_big__anon_2024
000002b8 r builtin.panic_messages.unreach
000000e8 r builtin.panic_messages.unreach__anon_2012
0000010b t builtin.panicOutOfBounds
0000008f r builtin.panicOutOfBounds__anon_1151
000000e9 t builtin.panicStartGreaterThanEnd
00000062 r builtin.panicStartGreaterThanEnd__anon_1149
0000079b t builtin.returnError
00000000 r builtin.zig_backend
         U _data
         U _data_loadaddr
         U _data_size
000015eb t debug.assert
00000223 t debug.panicExtra__anon_1150
00000022 r debug.panicExtra__anon_1150__anon_1236
00000355 t debug.panicExtra__anon_1152
000002ac r fmt.ANY
000000e4 r fmt.ANY__anon_1859
00000499 t fmt.bufPrint__anon_1381
0000052f t fmt.bufPrint__anon_1384
000001fd r fmt.cacheString__anon_1552
00001625 t fmt.digits2
00000101 r fmt.digits2__anon_2021
0000166f t fmt.digitToChar
000005c5 t fmt.format__anon_1506
000001f0 r fmt.format__anon_1506__anon_1514
000001fc r fmt.format__anon_1506__anon_1517
00000244 r fmt.format__anon_1506__anon_1574
000008f1 t fmt.format__anon_1579
00000250 r fmt.format__anon_1579__anon_1584
0000025c r fmt.format__anon_1579__anon_1587
000002a4 r fmt.format__anon_1579__anon_1593
00000e89 t fmt.formatBuf__anon_1934
0000125f t fmt.formatInt__anon_1930
0000178d t fmt.formatIntValue__anon_1924
000002a8 r fmt.formatIntValue__anon_1924__anon_1927
0000082d t fmt.formatType__anon_1572
000017c7 t fmt.formatValue__anon_1923
000002a6 r fmt.max_format_args
00000004 d hal.GPIO.gpioA_crl
00000008 d hal.GPIO.gpioA_odr
00000000 d hal.RCC.rcc_apb2enr
000001df t hal.Register(hal.GPIO_CRL,hal.GPIO_CRL).read
000001e5 t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).modify__anon_1119
000001d4 r hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).modify__anon_1119__anon_1186
00000487 t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).read
0000048d t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).write
000001d3 t hal.Register(hal.RCC_APB2ENR,hal.RCC_APB2ENR).write
0000086f t io.fixed_buffer_stream.fixedBufferStream__anon_1485
00000891 t io.fixed_buffer_stream.FixedBufferStream([]u8).getWritten
000017f1 t io.fixed_buffer_stream.FixedBufferStream([]u8).write
00000887 t io.fixed_buffer_stream.FixedBufferStream([]u8).writer
000009cb t io.writer.Writer(*io.fixed_buffer_stream.FixedBufferStream([]u8),error{NoSpaceLeft},(function 'write')).write
0000069f t io.writer.Writer(*io.fixed_buffer_stream.FixedBufferStream([]u8),error{NoSpaceLeft},(function 'write')).writeAll
00001151 t io.writer.Writer(*io.fixed_buffer_stream.FixedBufferStream([]u8),error{NoSpaceLeft},(function 'write')).writeByteNTimes
00000008 r .L__unnamed_1
00000020 r .L__unnamed_10
00000048 r .L__unnamed_11
00000028 r .L__unnamed_12
00000030 r .L__unnamed_13
00000038 r .L__unnamed_14
00000040 r .L__unnamed_15
00000058 r .L__unnamed_16
00000060 r .L__unnamed_17
00000068 r .L__unnamed_18
00000070 r .L__unnamed_19
00000010 r .L__unnamed_2
00000078 r .L__unnamed_20
00000080 r .L__unnamed_21
00000088 r .L__unnamed_22
00000090 r .L__unnamed_23
00000098 r .L__unnamed_24
000000a0 r .L__unnamed_25
000000a8 r .L__unnamed_26
000000b0 r .L__unnamed_27
000000b8 r .L__unnamed_28
00000018 r .L__unnamed_3
00000230 r .L__unnamed_4
00000290 r .L__unnamed_5
00000000 r .L__unnamed_6
00000004 r .L__unnamed_7
00000008 r .L__unnamed_8
0000000c r .L__unnamed_9
0000012d T main
0000000c d main.a
000001c5 t main.bus_fault
00000000 b main.c
000001cb t main.debug_monitor
000001d1 t main.dummy
00000088 r main.handlers
000001c1 t main.hard_fault
000000c4 r main.irq
000001c3 t main.memory_manage_fault
000001bf t main.nmi
000001cd t main.pend_sv
000001c9 t main.sv_call
000001cf t main.systick
000001c7 t main.usage_fault
0000161d t math.absCast__anon_1931
00000da9 t mem.readIntNative__anon_2008
00000001 T reset_handler
00000084 r start.simplified_logic
00000024 r target.arm.cpu.baseline
00000000 r target.arm.cpu.baseline__anon_536
00000009 r target.arm.cpu.baseline__anon_537
00000000 r target.Target.Cpu.Feature.Set.empty
00000a13 t unicode.utf8ByteSequenceLength
00000ad3 t unicode.utf8CountCodepoints
00000db5 t unicode.utf8Decode
00001a4b t unicode.utf8Decode2
00001be3 t unicode.utf8Decode3
00001e9f t unicode.utf8Decode4
00000000 R vector_table

On 0.12.0 I see:

00001452 t $d.1
000026b4 t $d.3
00000150 t $t.0
00001456 t $t.2
000026c4 t $t.4
00002f80 t .L__unnamed_1
00003384 t .L__unnamed_10
00003394 t .L__unnamed_11
0000337c t .L__unnamed_12
00003388 t .L__unnamed_13
00002f80 t .L__unnamed_14
00002f80 t .L__unnamed_15
00002f80 t .L__unnamed_16
00002f80 t .L__unnamed_17
00002f80 t .L__unnamed_18
00002f80 t .L__unnamed_19
00002f80 t .L__unnamed_2
00002f80 t .L__unnamed_20
00003380 t .L__unnamed_21
00003384 t .L__unnamed_22
00003394 t .L__unnamed_23
0000337c t .L__unnamed_24
00002f80 t .L__unnamed_25
000032f0 t .L__unnamed_26
00002f80 t .L__unnamed_27
00002f80 t .L__unnamed_3
00003208 t .L__unnamed_4
00002f80 t .L__unnamed_5
00003268 t .L__unnamed_6
00002f80 t .L__unnamed_7
00002f80 t .L__unnamed_8
00003380 t .L__unnamed_9
000032a0 t .L__zig_err_name_table
00002fa0 t Target.Cpu.Feature.Set.empty
00002fc4 t Target.arm.cpu.cortex_m3
         U __aeabi_memclr
         U __aeabi_memcpy
         U __aeabi_memset
00000020 d __anon_1351
00000081 d __anon_1374
000000af d __anon_1384
00000041 d __anon_1554
00000051 d __anon_1585
00000069 d __anon_1593
000000ae d __anon_1776
000000d7 d __anon_2430
0000011b d __anon_2459
000000eb d __anon_2479
0000025c d __anon_2532
000000f2 d __anon_2547
00000122 d __anon_2604
0000013e d __anon_2611
00000000 d __anon_280
0000000a d __anon_283
0000011f d __anon_2836
0000014f d __anon_2857
00000168 d __anon_2887
00000231 d __anon_2932
00000279 d __anon_2992
0000027a d __anon_3089
000001d8 R __exidx_end
00000000 R __exidx_start
00000000 T __fini_array_end
00000000 T __fini_array_start
00000000 T __init_array_end
00000000 T __init_array_start
00000000 T __preinit_array_end
00000000 T __preinit_array_start
00000000 B _bss
00000010 A _bss_size
00000000 D _data
0001364c A _data_loadaddr
00000284 A _data_size
00000010 B _ebss
00000284 D _edata
000001d8 R _etext
20005000 A _stack_top
00002ff8 t builtin.cpu
00000357 t builtin.default_panic
0000328e t builtin.mode
00003178 t builtin.os
00003025 t builtin.output_mode
0000024b t builtin.panicOutOfBounds
00000229 t builtin.panicStartGreaterThanEnd
00000b1b t builtin.panicUnwrapError
000032b0 t builtin.panic_messages.cast_truncated_data
00003230 t builtin.panic_messages.corrupt_switch
000032b4 t builtin.panic_messages.divide_by_zero
000032a4 t builtin.panic_messages.incorrect_alignment
00003174 t builtin.panic_messages.integer_overflow
0000322c t builtin.panic_messages.memcpy_alias
000032ac t builtin.panic_messages.memcpy_len_mismatch
00003318 t builtin.panic_messages.shift_rhs_too_big
00003314 t builtin.panic_messages.unreach
0000098b t builtin.returnError
00002f88 t builtin.zig_backend
00001ddb t debug.assert
00003292 t debug.default_enable_segfault_handler
00003291 t debug.have_segfault_handling_support
00003290 t debug.native_os
00000365 t debug.panicExtra__anon_1106
000004c1 t debug.panicExtra__anon_1107
00000f2b t debug.panicExtra__anon_2203
0000328f t debug.runtime_safety
00000010 B end
000032a8 t fmt.ANY
0000062f t fmt.bufPrint__anon_1341
000006e7 t fmt.bufPrint__anon_1342
00001fc3 t fmt.bufPrint__anon_2211
00001e73 t fmt.digitToChar
00001e0d t fmt.digits2
00001509 t fmt.formatBuf__anon_2207
00001f89 t fmt.formatIntValue__anon_2204
00001a1f t fmt.formatInt__anon_2206
00000a1f t fmt.formatType__anon_1956
00002c93 t fmt.formatType__anon_2214
00000f01 t fmt.formatValue__anon_2202
0000079f t fmt.format__anon_1472
00000bb5 t fmt.format__anon_1957
00002c11 t fmt.format__anon_2213
0000328c t fmt.max_format_args
00000018 d hal.GPIO.gpioA_crl
0000001c d hal.GPIO.gpioA_odr
00000014 d hal.RCC.rcc_apb2enr
00000321 t hal.Register(hal.GPIO_CRL,hal.GPIO_CRL).read
00000327 t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).modify__anon_1079
0000061d t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).read
00000623 t hal.Register(hal.GPIO_ODR,hal.GPIO_ODR).write
00000315 t hal.Register(hal.RCC_APB2ENR,hal.RCC_APB2ENR).write
00000a9f t io.GenericWriter(*io.fixed_buffer_stream.FixedBufferStream([]u8),error{NoSpaceLeft},(function 'write')).typeErasedWriteFn
00000ea7 t io.Writer.write
00000887 t io.Writer.writeAll
00001983 t io.Writer.writeBytesNTimes
00000b55 t io.fixed_buffer_stream.FixedBufferStream([]u8).getWritten
00000c9d t io.fixed_buffer_stream.FixedBufferStream([]u8).write
00000a95 t io.fixed_buffer_stream.FixedBufferStream([]u8).writer
00000a7d t io.fixed_buffer_stream.fixedBufferStream__anon_1442
00003293 t log.default_level
0000026d T main
00000031 d main.a
00000307 t main.bus_fault
00000000 b main.c
0000030d t main.debug_monitor
00000313 t main.dummy
00003028 t main.handlers
00000303 t main.hard_fault
00003064 t main.irq
00000305 t main.memory_manage_fault
00000301 t main.nmi
0000030f t main.pend_sv
0000030b t main.sv_call
00000311 t main.systick
00000309 t main.usage_fault
000032b9 t mem.native_endian
00000151 T reset_handler
00003024 t start.simplified_logic
00003294 t std.options
00002bcf t unicode.isSurrogateCodepoint
000032b8 t unicode.native_endian
0000339c t unicode.replacement_character
00001087 t unicode.utf8ByteSequenceLength
00002575 t unicode.utf8CodepointSequenceLength
0000114d t unicode.utf8CountCodepoints
0000142d t unicode.utf8Decode
0000207b t unicode.utf8Decode2
000021df t unicode.utf8Decode3
00002d49 t unicode.utf8Decode3AllowSurrogateHalf
00002295 t unicode.utf8Decode4
00001933 t unicode.utf8Encode
00002629 t unicode.utf8EncodeImpl__anon_2212
00000004 T vector_table

0.11.0 doesn't show those ...anon data symbols, there's less unicode symbols.

Expected Behavior

I'd expect the 0.11.0 behavior.

@MrOneTwo MrOneTwo added the bug Observed behavior contradicts documented or intended behavior label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant