git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix signed range problems with hex conversions

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 30, 2007, 17:42 UTC
Message-ID
<alpine.LFD.0.98.0705301038310.26602@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.98.0705301025170.26602@woody.linux-foundation.org>
On Wed, 30 May 2007, Linus Torvalds wrote:
Show 5 quoted lines
> 
> With this, gcc can just generate:
> 
> 	movzbl  (%rdi), %eax
>	...

Btw, in the kernel we have a rule for *.c -> *.s files exactly because it's nice to be able to easily say "ok, what does that generate".

Here's a patch to add such a rule to git too, in case anybody is interested. It makes it much simpler to just do

	make sha1_file.s

and look at the compiler-generated output that way, rather than having to fire up gdb on the resulting binary.

(Add -fverbose-asm or something if you want to, it can make the result even more readable)

		Linus
---
diff --git a/Makefile b/Makefile
index 7527734..7ffb803 100644
--- a/Makefile
+++ b/Makefile
@@ -846,6 +846,8 @@ git$X git.spec \
 
 %.o: %.c GIT-CFLAGS
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
+%.s: %.c GIT-CFLAGS
+	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
 %.o: %.S
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
Previous: Linus TorvaldsNext: Nicolas Pitre
Message 3 of 4 in “fix signed range problems with hex conversions”
  1. fix signed range problems with hex conversionsNicolas Pitre, May 30, 2007
  2. Linus TorvaldsMay 30, 2007
  3. Linus TorvaldsMay 30, 2007
  4. Nicolas PitreMay 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.