Page MenuHomeFreeBSD

Use a template assembly file for firmware object files.

Authored by jhb on Dec 11 2020, 9:25 PM.



Similar to r366897, this uses the .incbin directive to pull in a
firmware file's contents into a .fwo file. The same scheme for
computing symbol names from the filename is used as before to maximize
compatiblity and not require rebuilding existing .fwo files for
NO_CLEAN builds. Using ld -o binary requires extra hacks in linkers
to either specify ABI options (e.g. soft- vs hard-float) or to ignore
ABI incompatiblities when linking certain objects (e.g. object files
with only data). Using the compiler driver avoids the need for these
hacks as the compiler driver is able to set all the appropriate ABI

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb requested review of this revision.Dec 11 2020, 9:25 PM
This revision is now accepted and ready to land.Dec 11 2020, 10:26 PM

I had looked to see if I could use a common assembly file between this and embedfs.S I recently added, but there were enough subtle differences I kept them separate.

markj added inline comments.
196 ↗(On Diff #80608)

The indentation on this line looks off by one space.

44 ↗(On Diff #80608)

In embedfs.S you wrote %object. Is that equivalent? The GNU as docs seem to imply that it is but it's not super clear.

44 ↗(On Diff #80608)

Oh, hmm. They are equivalent, but I should instead use '%' so that this builds ok on ARM. Let me verify that it is broken on ARM and that using '%' fixes it.

jhb marked 2 inline comments as done.Dec 16 2020, 5:49 PM
  • Various fixes to pass tinderbox.
This revision now requires review to proceed.Dec 17 2020, 6:30 PM
190 ↗(On Diff #80846)

I added firmw.S as a dependency here. There's not a simple way to do it for sys/conf/files. I think I'd have to manually update all the entires in sys/conf/files to get it to work. :( I should perhaps do that, but it's a bit tedious.

39 ↗(On Diff #80846)

I had missed this .globl originally.

This revision is now accepted and ready to land.Dec 17 2020, 7:40 PM

(earlier I thought the breaking change was )

Apparently this change will crash a machine after inserting wireless USB (if_rsu, RTL8191S, vendor/device ID 0x0bda:0x8172) hardware.
r368738 / de66c99a works fine, so does if_rtwn_usb (RTL8188EU, vendor/device ID 0x0bda:0x8179) based hardware booting a kernel built from r368739.

I can provide a backtrace; do you want me to open a PR?